Click here to Skip to main content
15,877,168 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I am trying to implement a min heap using either a vector or a map to represent. In the min-heap each node has a value and 0, 1 or 2 children heaps.To add a new value to the heap it is added to the top of the heap. If the heap is empty the new value becomes the root.If heap is not empty then the smaller of the two values (current value in heap and the new value) is kept in the root. The larger of the two values is added the sub-heap with the smallest height. If both sub-heaps have the same height then the larger of the two values is added to the left heap. The process is repeated until a value is added to a new node at the bottom of the
I know the logic but dont know how to Implement it.Can someone help me with the code.
Updated 17-Oct-14 13:03pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900