next up previous
Next: Search Up: CSE 2320: Algorithms and Previous: Operations

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)





Copyright © 1998 The University of Texas at Arlington