Design And Analysis Of Algorithms Set 4

On This Page

This set of Design and Analysis of Algorithms Multiple Choice Questions & Answers (MCQs) focuses on Design And Analysis Of Algorithms Set 4

Q1 | Tower of hanoi problem can be solved iteratively.
  • true
  • false
Q2 | Minimum time required to solve tower of hanoi puzzle with 4 disks assuming one move takes 2 seconds, will be                      
  • 15 seconds
  • 30 seconds
  • 16 seconds
  • 32 seconds
Q3 | Master’s theorem is used for?
  • solving recurrences
  • solving iterative relations
  • analysing loops
  • calculating the time complexity of any code
Q4 | How many cases are there under Master’s theorem?
  • 2
  • 3
  • 4
  • 5
Q5 | What is the result of the recurrences which fall under second case of Master’s theorem (let the recurrence be given by T(n)=aT(n/b)+f(n) and f(n)=nc?
  • none of the below
  • t(n) = o(nc log n)
  • t(n) = o(f(n))
  • t(n) = o(n2)
Q6 | What is the result of the recurrences which fall under third case of Master’s theorem (let the recurrence be given by T(n)=aT(n/b)+f(n) and f(n)=nc?
  • none of the below
  • t(n) = o(nc log n)
  • t(n) = o(f(n))
  • t(n) = o(n2)
Q7 | We can solve any recurrence by using Master’s theorem.
  • true
  • false
Q8 | Under what case of Master’s theorem will the recurrence relation of merge sort fall?
  • 1
  • 2
  • 3
  • it cannot be solved using master’s theorem
Q9 | Under what case of Master’s theorem will the recurrence relation of stooge sort fall?
  • 1
  • 2
  • 3
  • it cannot be solved using master’s theorem
Q10 | Which case of master’s theorem can be extended further?
  • 1
  • 2
  • 3
  • no case can be extended
Q11 | What is the result of the recurrences which fall under the extended second case of Master’s theorem (let the recurrence be given by T(n)=aT(n/b)+f(n) and f(n)=nc(log n)k?
  • none of the below
  • t(n) = o(nc log n)
  • t(n)= o(nc (log n)k+1
  • t(n) = o(n2)
Q12 | Under what case of Master’s theorem will the recurrence relation of binary search fall?
  • 1
  • 2
  • 3
  • it cannot be solved using master’s theorem
Q13 | 7 T (n/2) + 1/n
  • t(n) = o(n)
  • t(n) = o(log n)
  • t(n) = o(n2log n)
  • cannot be solved using master’s theorem
Q14 | What is the worst case time complexity of KMP algorithm for pattern searching (m = length of text, n = length of pattern)?
  • o(n)
  • o(n*m)
  • o(m)
  • o(log n)
Q15 | What is the time complexity of Z algorithm for pattern searching (m = length of text, n = length of pattern)?
  • o(n + m)
  • o(m)
  • o(n)
  • o(m * n)
Q16 | What is the auxiliary space complexity of Z algorithm for pattern searching (m = length of text, n = length of pattern)?
  • o(n + m)
  • o(m)
  • o(n)
  • o(m * n)
Q17 | The naive pattern searching algorithm is an in place algorithm.
  • true
  • false
Q18 | Rabin Karp algorithm and naive pattern searching algorithm have the same worst case time complexity.
  • true
  • false
Q19 | Which of the following sorting algorithms is the fastest?
  • merge sort
  • quick sort
  • insertion sort
  • shell sort
Q20 | Quick sort follows Divide-and-Conquer strategy.
  • true
  • false
Q21 | What is the worst case time complexity of a quick sort algorithm?
  • o(n)
  • o(n log n)
  • o(n2)
  • o(log n)
Q22 | Which of the following methods is the most effective for picking the pivot element?
  • first element
  • last element
  • median-of-three partitioning
  • random element
Q23 | Which is the safest method to choose a pivot element?
  • choosing a random element as pivot
  • choosing the first element as pivot
  • choosing the last element as pivot
  • median-of-three partitioning method
Q24 | What is the average running time of a quick sort algorithm?
  • o(n2)
  • o(n)
  • o(n log n)
  • o(log n)
Q25 | Which of the following sorting algorithms is used along with quick sort to sort the sub arrays?
  • merge sort
  • shell sort
  • insertion sort
  • bubble sort