Question: Binary Search Trees, 20 points] Specify and explain what is the worst-case asymptotic time needed to insert a sequence of log(n) copies each of the
![Binary Search Trees, 20 points] Specify and explain what is the](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f52b4f490b2_43866f52b4ea7db5.jpg)
Binary Search Trees, 20 points] Specify and explain what is the worst-case asymptotic time needed to insert a sequence of log(n) copies each of the numbers 1 through n to an initially empty binary search tree in each of the following cases. For example, if n = 1010, then we will insert ten 1's, followed by ten 2's, followed by ten 3's, etc. Note that we are referring to a standard binary search tree, which is not necessarily balanced. a. Assuming that we don't make any changes to the BST insert that we saw in class b. Assuming that we modify the BST insert algorithm as follows: We keep a linked list of nodes with equal keys at each node x, and insert equal keys to this list. Assuming that we modify the BST insert algorithm as follows: When inserting an equal key to node x, we randomly choose if to add it to the left or to the right of x c. d. Assuming that we modify the BST insert algorithm as follows: We keep a boolean flag at each node x specifying either 'left' or 'right'. When inserting an equal key to node x, we insert to the left or to the right of x, based on the current value of the flag, and flip the value of the flag
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
