I need help answeting the following 9 questions. I know it looks crazy but it\'s
ID: 3733805 • Letter: I
Question
I need help answeting the following 9 questions. I know it looks crazy but it's only 9 Multiple Choice questions.
1. What is the Big O of the following function?
Assume a and b are constants. x is a variable.
x = a + b
Return x
a. Big O (0)
b. Big O (1)
c. Big O (2)
d. Big O (3)
2. What is the Big O of the following function?
Assume i is a loop counter variable and n is a constant.
For i = 1 to n do
print i
a. Big O (n2)
b. Big O (0)
c. Big O (1)
d. Big O (n)
3. Which of the following about Big O is correct?
a. Big O is about how difficult it is for humans to understand an algorithm
b. Big O is fodder for llama
c. Big O is about the complexity of a function
d. Big O is about how a function uses different variables to generate an outcome
4. What is the Big O of a function that looks up a certain item on an unsorted list? (linear search)
a. O(n)
b. O(logn)
c. O(nlogn)
d. O(1)
5. What is the Big O of merge sort in a worst case scenario?
a. O(1)
b. O(N)
c. O(N^2)
d. O(logN)
e. O(NlogN)
6. What is the Big O of merge sort in a best case scenario?
a. O(N^2)
b. O(logN)
c. O(N)
d. O(1)
e. O(NlogN)
7. What is the Big O of quick sort in a worst case scenario?
a. O(1)
b. O(N^2)
c. O(NlogN)
d. O(N)
e. O(logN)
8. What is the Big O of quick sort in a best case scenario?
a. O(NlogN)
b. O(N^2)
c. O(1)
d. O(N)
e. O(logN)
9. What is the Big O of searching on a sorted list?
a. O(N^2)
b. O(NlogN)
c. O(N)
d. O(logN)
e. O(1)
a. Big O (0)
b. Big O (1)
c. Big O (2)
d. Big O (3)
Explanation / Answer
1. b. Big O(1), this function will always run in a constant time
2.d. Big O(n).
3. c. Big O is about the complexity of a function
4. a. O(n)
5. e. O(NlogN)
6. e. O(NlogN)
7. b. O(N^2)
8. a.O(NlogN)
9. c. O(N)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.