Given the following problem , I\'m not completely sure with my current solution :
Question :
Given a maximum heap with n ele
This is possible in a max-heap because you are only printing elements from the tree, not extracting them.
Start by identifying the maximum element, which is located at the root node. Form a pointer to a node and add it to an otherwise empty "maximums" list. Then, for each of the k values, perform the following steps in a loop.
In total, then, the run time is O(klog(k)), as desired.