Given an AVL tree show (using pseudocode) how to support the following queries: 1) RangeCount(k1, k2): Count
Fantastic news! We've Found the answer you've been seeking!
Question:
Given an AVL tree show (using pseudocode) how to support the following queries:
1) RangeCount(k1, k2): Count the number of keys in the AVL tree which are between k1 and k2 in O(log n) time (Hint: Recall the size field).
2) RangeReport(k1, k2): List all the keys in AVL tree which are in between k1 and k2 in O(log n + output) time.
3) 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) time. (Hint: Consider storing an additional field in the Node structure and show how can this field be maintained during updates)
Related Book For
Managing Information Technology
ISBN: 978-0132146326
7th Edition
Authors: Carol Brown, Daniel DeHayes, Jeffrey Hoffer, Wainright Marti
Posted Date: