Question: 1. Suppose we are given the following code public int find(Object array[], Object toFind) { for(int i = 0; i < array.length; i++) { if(array[i].equals(toFind))
1. Suppose we are given the following code
public int find(Object array[], Object toFind) { for(int i = 0; i < array.length; i++) { if(array[i].equals(toFind)) { return i; } } return -1; } What is the order of magnitude in terms of Big O?
Group of answer choices
O(n2)
O(nlogn)
O(2n)
O(n)
2. Which of the following shows runtimes from most efficient to least efficient from left to right?
Group of answer choices
O(1),O(nlogn),O(n2),O(n3),O(2n)
O(nlogn),O(logn),O(n2),O(3n),O(1)
O(n!),O(2n),O(n3),O(n2),O(1)
O(1),O(nlogn),O(n),O(logn),O(n!)
3. An efficient algorithm will always be more efficient than its less efficient counterpart even for small problem sizes.
Group of answer choices
True
False
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
