Skip to content
View in the app

A better way to browse. Learn more.

Tip.It Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Java Homework Debugging Help?

Featured Replies

I've been having some trouble with my java homework. Ok, first...these are my two files (Note...they're completely safe. Anyone who can't tell within 2 seconds they're completely safe probably doesn't need to be looking anyway :))

 

 

 

 

 

 

 

http://www.mizzou.edu/~agm257/Heap.java

 

 

 

http://www.mizzou.edu/~agm257/SortArray.java

 

 

 

 

 

 

 

Ok, so our assignment was to implement a Heap (see heap.java) using Nodes, and then create a random array of x values between 0 and y, x and y are args[0] and args[1].

 

 

 

 

 

 

 

So here's my question. Why does my sort crap out on me half way through? For example, if you were to run

 

 

 

java SortArray 5 5

 

 

 

the output might be something of this sort

 

 

 




0



5



2



0



1



=====



0



0



2



2



2



 

 

 

 

 

 

 

Where "0,5,2,0,1" are the randomly generated numbers, and below the equal sign is the attempt at sorting. It seems completely random where the sorting stops and the repeating begins. Anyone got any ideas?[/code]

  • Author

Thanks.

 

 

 

 

 

 

 

Ok, through my testing, I found out Insert works fine, it's just DeleteMin that's wrong.

  • Author

nevermind, I figured it out. I forgot to decrement the Node size in one spot.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.