InterviewSolution
Saved Bookmarks
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Which of the following is true about merge sort?(A) Merge Sort works better than quick sort if data is accessed from slow sequential memory.(B) Merge Sort is stable sort by nature(C) Merge sort outperforms heap sort in most of the practical situations.(D) All of the above. |
| Answer» | |
| 2. |
The number of elements that can be sorted in time using heap sort is(A) (B) (C) (d) (A) A(B) B(C) C(D) D |
| Answer» | |
| 3. |
Given an array where numbers are in range from 1 to n6, which sorting algorithm can be used to sort these number in linear time?(A) Not possible to sort in linear time(B) Radix Sort(C) Counting Sort(D) Quick Sort |
| Answer» | |
| 4. |
In quick sort, for sorting n elements, the (n/4)th smallest element is selected as pivot using an O(n) time algorithm. What is the worst case time complexity of the quick sort?(A) (n)(B) (nLogn)(C) (n^2)(D) (n^2 log n)(A) A(B) B(C) C(D) D |
| Answer» | |
| 5. |
Consider the Quicksort algorithm. Suppose there is a procedure for finding a pivot element which splits the list into two sub-lists each of which contains at least one-fifth of the elements. Let T(n) be the number of comparisons required to sort n elements. Then(A) T(n) <= 2T(n/5) + n(B) T(n) <= T(n/5) + T(4n/5) + n(C) T(n) <= 2T(4n/5) + n(D) T(n) <= 2T(n/2) + n |
| Answer» | |
| 6. |
Which of the following sorting algorithms has the lowest worst-case complexity?(A) Merge Sort(B) Bubble Sort(C) Quick Sort(D) Selection Sort |
| Answer» | |
| 7. |
Which sorting algorithms is most efficient to sort string consisting of ASCII characters?(A) Quick sort(B) Heap sort(C) Merge sort(D) Counting sort |
| Answer» | |
| 8. |
Which of the following sorting algorithms in its typical implementation gives best performance when applied on an array which is sorted or almost sorted (maximum 1 or two elements are misplaced).(A) Quick Sort(B) Heap Sort(C) Merge Sort(D) Insertion Sort |
| Answer» | |
| 9. |
Consider a situation where swap operation is very costly. Which of the following sorting algorithms should be preferred so that the number of swap operations are minimized in general?(A) Heap Sort(B) Selection Sort(C) Insertion Sort(D) Merge Sort |
| Answer» | |
| 10. |
Which of the following is not a stable sorting algorithm in its typical implementation.(A) Insertion Sort(B) Merge Sort(C) Quick Sort(D) Bubble Sort |
| Answer» | |