Xhmster 44 Top ⭐ 💫
if node is leaf: // examine each element stored in the leaf for e in node.elements: if e.v > P: push result with (e.id, e.v) if size(result) > k: pop smallest from result P ← smallest value in result else: // push children ordered by descending maxVal push children of node onto stack sorted by child.maxVal (desc) return result