for block data movements in the interests of pedagogywe have elected to use the bintrees module which implements sorted sets and sorted dictionaries using balanced bsts howeverany reasonable interviewer should accept sortedcontainers wherever we use bintrees belowwe describe the functionalities added by bintrees insert(einserts new element in the bst discard(eremoves in the bst if present min_item()/max_item(yield the smallest and largest key-value pair in the bst min_key()/max_key(yield the smallest and largest key in the bst pop_min()/pop_max(remove the return the smallest and largest key-value pair in the bst it' particularly important to note that these operations take (log )since they are backed by the underlying tree the following program illustrates the use of bintrees bintrees rbtree ([( 'alfa ')( 'bravo ')( 'charlie ')( 'delta ')( 'echo ')]print( [ ]'bravo print( min_item ( max_item ()( 'bravo ')( 'charlie '{ 'bravo ' 'delta ' 'alfa ' 'echo ' 'charlie ' 'golf ' insert ( 'golf 'print(tprint( min_key ( max_key () discard ( print( { 'bravo ' 'alfa ' 'echo ' 'charlie ' 'golf ' ( 'bravo ' pop_min (print( { 'alfa ' 'echo ' 'charlie ' 'golf ' ( 'golf ' pop_max (print( { 'alfa ' 'echo ' 'charlie ' test if binary tree satisfies the bst property write program that takes as input binary tree and checks if the tree satisfies the bst property hintis it correct to check for each node that its key is greater than or equal to the key at its left child and less than or equal to the key at its right childsolutiona direct approachbased on the definition of bstis to begin with the rootand compute the maximum key stored in the root' left subtreeand the minimum key in the root' right subtree we check that the key at the root is greater than or equal to the maximum from the left subtree and less than or equal to the minimum from the right subtree if both these checks passwe recursively check the root' left and right subtrees if either check failswe return false