Traverses tree in depth first order
function traverseTree ( root ) { if ( root == null ) return ; while ( root != null ) { document . write ( root . data + " " ) ; if ( root . child != null ) traverseTree ( root . child ) ; root = root . next ; } }