Jump to content

Java Homework Debugging Help?


Ulysses_S_Grant

Recommended Posts

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]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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