Solution
Question 17
20 comparisons
Question 18
O(nlog2n),O(nlog2n)
Explanation
17)
An ordered array of one billion elements can be searched using no more than 20 comparisons using a binary search.
Hence Answer is 20 comparisons
---
18)
In merge sort it does not matter if the data is sorted / random/reversed as Therefore the time complexity of the merge sort is always the O(n logn) for any case.
---
all the best
About how many comparisons would the binary search makes if the list is of length 1...
For a list of length n, insertion sort makes _key comparisons, in the worst case. None of these O(nlogzn) On O) O() Question 20 The time complexity of the quick sort is in the worst case and in the average case O), O) O(nlogon), O(nlogon) (12), O(nlog.) O(nlogon). 0() O(P), (n)
How many comparisons will it take for the binary search to find the number 17 in the list of numbers 1 4 5 7 8 17 21 24 28 29 31 37 39?
The time-complexity of searching an AVL tree is in the worst case and in the average case. On), On) O(logot). O(log O ON), C(n) 0(), O(log) Question 16 2 pts The time-complexity of searching a binary search tree is in the worst case and in the average case (1), O(log) O(logn), O(log,n) On), On) 001), 001)
1. Randomized Binary Search Which are true of the randomized Binary Search algorithm? Multiple answers:You can select more than one option A) It uses a Variable-Size Decrease-and-Conquer design technique B) Its average case time complexity is Θ(log n) C) Its worst case time complexity is Θ(n) D) It can be implemented iteratively or recursively E) None of the above 2. Randomized Binary Search: Example Assume you have an array, indexed from 0 to 9, with the numbers 1 4 9...
1. What is the worst case time complexity of insertion into a binary search tree with n elements? You should use the most accurate asymptotic notation for your answer. 2. A binary search tree is given in the following. Draw the resulting binary search tree (to the right of the given tree) after deleting the node with key value 8. 10 3. You have a sorted array B with n elements, where n is very large. Array C is obtained...
1.For a sorted list of 512 elements, a binary search takes at most _______ comparisons? 11 9 10 100
Question 4 (10 marks) When analysing the complexity of algorithms, there are three main approaches: worst case, best case and average case. As an example, consider measuring the complexity of list-merging by counting the number of comparisons used As a test example, assume the following A1: There are two ordered lists, each of length 4, say A2: Neither list contains repeats, so a! < a2 < аз < a4 and bl <b2 < b3 < b4 A3: The lists are...
Approximately how many comparisons in the worst case would need to be made on a sorted list of size 290 if we used a binary searching algorithm? a. between 0 and 10 b. between 10 and 50 c. between 50 and 100 d. between 100 and 1000 e. more than 1000
3. Prove that any comparison-based algorithm for constructing a binary search tree from an arbitrary list of n elements takes Ω(n log n) time in the worst case. Hint: Think about reducing the problem of sorting to performing a set of operations on a binary search tree.
please Type your answer! thanks
ting a true false. You (1) Mark the following assertions about sorting at need to explain your answers. (a) (2 points) BubbleSort can be implemente time in N(n). Semented to have a better (b) (2 points) Selection Sort has a worst-case as a worst-case running time in Oslo (e) (2 points) The recursive version or benary search than the non-recursive version. (d) (2 points) The worst-case time complexity of NergeSortising ( a s ( points)...