December 6, 200619 yr 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]
December 6, 200619 yr Author Thanks. Ok, through my testing, I found out Insert works fine, it's just DeleteMin that's wrong.
December 6, 200619 yr Author nevermind, I figured it out. I forgot to decrement the Node size in one spot.
Create an account or sign in to comment