Ulysses_S_Grant Posted December 6, 2006 Share Posted December 6, 2006 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 More sharing options...
azntemplar_00 Posted December 6, 2006 Share Posted December 6, 2006 Moved to Tech and Computers. Link to comment Share on other sites More sharing options...
Ulysses_S_Grant Posted December 6, 2006 Author Share Posted December 6, 2006 Thanks. Ok, through my testing, I found out Insert works fine, it's just DeleteMin that's wrong. Link to comment Share on other sites More sharing options...
Ulysses_S_Grant Posted December 6, 2006 Author Share Posted December 6, 2006 nevermind, I figured it out. I forgot to decrement the Node size in one spot. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now