next up previous
Next: Up: Previous:

Search

This is a generalization of binary tree search.

Search(x, k)
$\;\;\;\;\;$if k in node x
$\;\;\;\;\;$then return x and i such that keyi(x) = k
$\;\;\;\;\;$else if x is a leaf
$\;\;\;\;\;$ $\;\;\;\;\;$then return NIL
$\;\;\;\;\;$ $\;\;\;\;\;$else find i such that keyi-1(x) < k < keyi(x)
$\;\;\;\;\;$ $\;\;\;\;\;$ $\;\;\;\;\;$DiskRead(childi(x))
$\;\;\;\;\;$ $\;\;\;\;\;$ $\;\;\;\;\;$return Search(childi(x), k)

Click mouse to advance to next frame.


next up previous
Next: Up: Previous: