x******i 发帖数: 172 | 1 Given an AVL tree (using pseudocode) how to support the following queries:
RangeMin (k1, k2): consider the field data stored in each node to be an
integer. Find the key with minimum data values among all the keys which are
between k1 and k2 in O(log n) times. (Hint: Consider storing an additional
field in the Node structure and show how can this field be maintained during
updates).
Thank you very much. | l****c 发帖数: 782 | 2 可以在每个结点,除了自己数本身再存在其children的上下限?RangeMin 中先判断
current value与k1关系,再觉得发挥current value, or go left, or go right, or
quit.
更新的时候,加结点好说,减结点就找下一个大的或小的?
怎么感觉更像是课上作业呢。。。 |
|