Give pseudocode for the following Btree function getKeysInRa

Give pseudocode for the following B-tree function:

getKeysInRange(x, k1, k2): The function returns the set of all keys k satisfying k1 k k2 in the B-tree pointed to by x.

Solution

The Pseudo code for the given problem will be

If value of root’s key is greater than k1, then recursively call in left subtree.If value of root’s key is in range, then print the root’s key.If value of root’s key is smaller than k2, then recursively call in right subtree.

Give pseudocode for the following B-tree function: getKeysInRange(x, k1, k2): The function returns the set of all keys k satisfying k1 k k2 in the B-tree pointe

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site