class BinTree
	begin
		int value;
		^BinTree left, right;
	end

int freeNode = 0;
[ 10 ]BinTree nodeHeap;

^BinTree new( int level; int value; )
	begin
		^BinTree node = nodeHeap[ freeNode++ ];
		node.value = value;
		node.left = null;
		node.right = null;
		return node;
	end

void insert( int level; ^^BinTree node; int value; )
	begin
		if node^ == null then
			node^ = new( level + 1, value );
		else
			if value < node^.value then
				insert( level + 1, &node^.left, value );
			elif node^.value < value then
				insert( level + 1, &node^.right, value );
			end
		end
	end

void printTree( ^BinTree node; )
	begin
		if node != null then
			printTree( node.left );
			printf( "%d ", node.value );
			printTree( node.right );
		end
	end

^BinTree node;

insert( 0, &node, 52 );
insert( 0, &node, 14 );
insert( 0, &node, 23 );
insert( 0, &node, 44 );
insert( 0, &node, 18 );	//	Display at maximum level of recursion

printTree( node );
printf( "\n" );
