Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • When I push 10, could you please tell me what the values of I and j would be? Commented Apr 4, 2016 at 3:10
  • Also could you tell me in which part of the code the parent of the current element is found/extracted for comparison? Commented Apr 4, 2016 at 3:12
  • As it is the first element no comparison will be made. You can check the trace of the functor by adding inside the function the line: std::cout << i << " " << j << std::endl Commented Apr 4, 2016 at 3:12
  • thank you for your answer. Could you also answer the other question? Commented Apr 4, 2016 at 3:40
  • When the function push is executed the comparison with the parent (step 2) is executed in a recursive like manner (step 3). To find the parent of a giving node there are various possibilities depending on how the structure is represented, the most common ones are: if represented with arrays have a math function that returns the parent idx or; if represented as a tree having a pointer to it. Commented Apr 4, 2016 at 4:37