Couple of tricky questions in MCQ:
how many comparison you have on 5 element array to find minimum value? 4 times
Given a list of 1000 elements which of the following numbers is the largest? (all of them)
-The time complexity of g(n, x, y) is O(n). What is the time complexity of f(n)? O(nlogN)
def f(n):
if n == 1:
return 1
x = f(n/2)
y = f (n/2)
return g(n,x,y)
-which of the following algorithm finds the shortest path in any unweighted graph? BFS
-You are given an array with 10^8 elements and you must compute the sum A[j]+A[k] for every possible pair of elements in the array. How long will this computation take on a single mainstream computer? (milliseconds, seconds, hours, or a few hours) not sure what this answer is