port cpp impl for link_list and bst