Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
Thread: Heap Implementation Question!
11-24-2002, 07:16 AM #1
- Join Date
- Nov 2002
- Thanked 0 Times in 0 Posts
Heap Implementation Question!
I'm writing a Heap implementation using an array. I'm having trouble writing the sorting part of it, such as inserting items into a heap and sorting them max term on top and also min term on top. Can anybody help?
if so I'll post the code i've written so far.
(u might be wondering why I'm implementing a heap code, it's for class =)
11-24-2002, 02:46 PM #2
- Join Date
- May 2002
- Marion, IA USA
- Thanked 83 Times in 82 Posts
We will not write the code for you as this is a school assignment. I remember all too well how much fun (not) those were to write in my computer science courses at college.
Just think about how the algorith works then think what you need to do to accomplish it.
Then if you have a question on how to something in the language you are using then ask a specific question about the language.
CodingForums Supreme Overlord
All Hail Spookster
11-24-2002, 07:44 PM #3
Think about writing a trickleup() method. When you add an item to the heap, trickleup() it. This should just keep swapping it up until it shouldn't any longer.
Your teacher should have went over stuff like that in class...