Question 1 Binary Search Trees Consider the following procedure input: A list of integers a of size n local: A binary se
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Question 1 Binary Search Trees Consider the following procedure input: A list of integers a of size n local: A binary se
Question 1 Binary Search Trees Consider the following procedure input: A list of integers a of size n local: A binary search tree t without self-balancing t = 0; foreach x E a do // Iterate over all elements of a in order t+insert(t, x); end For each of the complexities below, state whether there exists an input of arbitrary length In that makes the algorithm run in that time. If it exists, describe how to construct such an input (you can even use an algorithm and a data structure to do so) and give an example of length n = 7. If it does not exist, explain your answer. (a) O(log n) [4 marks] [4 marks] (b) O(n) (c) O(nlog n) [4 marks] (d) O(n²) [4 marks] (e) O(n³) [4 marks]