Note that the entries do not need to be reported in sorted order. Use binary recursion on the subtrees of the heap and think about where the keys smaller than
k
are stored in the heap
T
.