Find the K'th Maximum Element in a Binary Search Tree . Do it in O(log N).
Please dont do a in order tree traversal and return the K'th element from
the end. I told that but interviewer did not wanted me to traverse the
entire tree. Any suggestions ?
m*****f 发帖数: 1243
2
没说不能preprocess阿, 每个节点储存tree size就行了
s******s 发帖数: 3694
3
好好找找以前的帖子, 俺写过怎么实现
max
to
【在 s*******n 的大作中提到】 : Find the K'th Maximum Element in a Binary Search Tree . Do it in O(log N). : Please dont do a in order tree traversal and return the K'th element from : the end. I told that but interviewer did not wanted me to traverse the : entire tree. Any suggestions ?