implementation of bst