Top-down binary tree construction
BuildTree( SetOfKeys ) : tree; begin K := select( SetOfKeys ); A1 := Keys in SetOfKeys < K; A2 := Keys in SetOfKeys > K; return( NewNode( K, BuildTree(A1), BuildTree(A2) )) end;
Pascal
source (3416.build.p)
©
Addison-Wesley
Publishing Co. Inc.