Search for node with key x. Start with i as the root.
typedef int** Tree; #define NULL 0 int value = 0; int parent = 1; int left = 2; int right = 3; int Find( Tree T, int x, int i ) { if( i == NULL ) { return NULL; } if( x == T[value][i] ) { return i; } if( x < T[value][i] ) { return Find(T, x, T[left][i]); } return Find(T, x, T[right][i]); }
Running time in terms of height of tree? How does this compare to doing the same thing in a heap?
How find minimum? Running time? Compared to heap?
Easily extended to insert x if it is not found.