Question: 1. What is the time complexity for inserting/deleting at the beginning of the 10 points array? a. 0(1) b. O(n) c. O(nlogn) d. O(logn) 2.
1. What is the time complexity for inserting/deleting at the beginning of the 10 points array?
a. 0(1)
b. O(n)
c. O(nlogn)
d. O(logn)
2. What is the worst case run-time complexity of binary search algorithm? 10 points
a. O(n*n*n)
b. O(n)
c. O(nn)
d. O(log n)
Sol95:
- The time complexity for inserting/deleting at the beginning of the array is O(n), as all the elements in the array need to be shifted to maintain the order.
- The worst case run-time complexity of binary search algorithm is O(log n), as the search space is divided in half at each step, resulting in a logarithmic time complexity.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
