class BinTree( int value; BinTree left, right; );

void createLeaf( int level; var BinTree node; int value; ) {
	node = new BinTree{ value, null, null };
	}

void insert( int level; var BinTree node; int value; ) {
	if ( node == null )
		createLeaf( level + 1, node, value );
	else if ( value < node.value )
		insert( level + 1, node.left, value );
	else if ( node.value < value )
		insert( level + 1, node.right, value );
	}

void printTree( BinTree node; ) {
	if ( node != null ) {
		printTree( node.left );
		print( node.value + " " );
		printTree( node.right );
		}
	}

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 );
println( "" );
