A utility function to do inorder traversal of BST
function inorder ( root ) { if ( root != null ) { inorder ( root . left ) ; document . write ( " " + root . key + " " ) ; if ( root . parent == null ) document . write ( " " ) ; else document . write ( " " + root . parent . key + " " ) ; inorder ( root . right ) ; } }