class code for BST traverse