Question: Question 4: Implement the following function: def find_min_abs_difference(bst) The function is given a binary search tree bst, where all its keys are non-negative numbers. When

Question 4: Implement the following function: def find_min_abs_difference(bst) The function is given a binary search tree bst, where all its keys are non-negative numbers. When called, it returns the minimum absolute difference between keys of any two nodes in bst. For example, if bst is the following tree: The call find_min_abs_difference(bst) should return 1 (since the absolute difference between 6 and 7 is 1, and there are no other keys that their absolute difference is less than 1)

.Implementation requirement: The runtime of this function should be linear. That is, if bst contains n nodes, this function should run in ?(). Hint: To meet the runtime requirement, you may want to define an additional, recursive, helper function, that returns more than one value (multiple return values would be collected as a tuple).

PYTHON

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!