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:

  1. 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.
  2. 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

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 Programming Questions!