figure an example of bst the following program demonstrates how to check if given value is present in bst it is nice illustration of the power of recursion when operating on bsts def search_bst (tree key)return (tree if not tree or tree data =key else search_bst (tree left keyif key tree data else search_bst (tree right key)since the program descends tree with in each stepand spends ( time per levelthe time complexity is ( )where is the height of the tree with bst you can iterate through elements in sorted order in time ( (regardless of whether it is balancedsome problems need combination of bst and hashtable for exampleif you insert student objects into bst and entries are ordered by gpaand then student' gpa needs to be updated and all we have is the student' name and new gpawe cannot find the student by name without full traversal howeverwith an additional hash tablewe can directly go to the corresponding entry in the tree the bst property is global property-- binary tree may have the property that each node' key is greater than the key at its left child and smaller than the key at its right childbut it may not be bst table top tips for binary search trees know your binary search tree libraries some of the problems in this entail writing bst classfor othersyou can use bst library python does not come with built-in bst library the sortedcontainers module the best-in-class module for sorted sets and sorted dictionaries-it is performanthas clean api that is well documentedwith responsive community the underlying data structure is sorted list of sorted lists its asymptotic time complexity for inserts and deletes is on)since these operations entail insertion into list of length roughly nrather