StopWatch 0 Newbie Poster

Hi all,
I am senior in high school and I am currently taking computer science classes in which we are learning C++. I understand the most basic implmentations of C++ fundamentals. I am seeming to have a lack of full understanding with heaps. I have borrowed several books in the library about algorithms and such. I figured a heap class of the sorts should not be complicated. To my best understanding in a min heap is where every node is less than its child. I would like for someone to check out my simple implementation of a min heap if everything seems logical because when I print an final output something does not seem quite right. I based my implmenation off several suggestions on how to use the STL algorithm class and the STL functional class to do a bit of trickery to turn it into a min heap intsead of a max heap.

MinHeap Class Implementation
http://pastebin.com/6b8zfp9N

Driver
http://pastebin.com/nWsUv5bM

I posted them to pastebin to save some post room.

Output:

22
55
99
303
101
997

Everything seems right except for the last two integers. I maybe wrong but is this how a heap is read tree-wise from left to right?

root = 22

children of root, 55 & 99

children of 55, 303 & 101

children of 99, 997

is this correct?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.