I'm trying to type up a program that will generate sorted runs that are greater than the size of memory. The momory can hold a tournament tree with 4 elements. I have 16 elements to put in. It's suppose to take the 4 ints, do a min winner tree, toss the winner into an array, remove the winner from the tree, then insert a new given element. Program compares tree elements to the last int in the winner array. If the tree element is smaller than the last array in winner, it is ignored. Whenever all the tree elements are smaller than the last int in the winner array, the winner array is printed. The entire winner array is then erased.
Sorry if my code is a little funny. I've done most of the typing while sick.
Also, these three lines are giving the complier a fit:
[ March 27, 2007: Message edited by: Christopher Beech ] [ March 27, 2007: Message edited by: Christopher Beech ]
If a method is not doing what you expect, then you need to debug it. At the very least put some print statements in which will show you the path it is taking thru the code.
Once you know what it is doing, if you can't see why it is doing this, come back and ask. Show us the test data you're using and describe which route thru the code you expect it to take and which route it is actually taking.
You say you've been at it all night. Well, tell us what you've found during this time, so we don't have to repeat all your tests. Debugging is time consuming. The less people have to do to help you, the more likely it is you'll get help.