Font size
WorksheetsSorting Quiz
Total questions: 15
Worksheet time: 8mins
How many passes does an insertion sort algorithm consist of?
n
n-1
n+1
n2
What is the average case running time of an insertion sort algorithm?
O(n)
O(nlogn)
O(logn)
O(n2)
Insertion Sort is
stable and sorts in place
unstable and sorts in place
stable and does NOT sort in place
NOT stable and does NOT sort in place
Which of the following sorting algorithm is best suited if the elements are already sorted?
Insertion Sort
Merge Sort
Heap Sort
Merge sort uses which of the following technique to implement sorting?
backtracking
greedy algorithm
divide and conquer
dynamic programming
What is the average case time complexity of merge sort?
O(nlogn)
O(n2logn)
O(n2)
O(n)
What is the space complexity of merge sort?
O(n2)
O(1)
O(2)
O(n)
What is the worst case time complexity of merge sort?
O(nlogn)
O(n2logn)
O(n2)
O(n)
Which of the following is good for sorting arrays having less than 40 elements?
(a)
Time it takes to build a binary heap
O(n)
O(n2)
O(n3)
What is the corresponding array for this tree? (Answer format: 1 2 3 4)
(a)
The essential part of Heap sort is construction of max-heap. Consider the tree shown below, the node 24 violates the max-heap property. Once heapify procedure is applied to it, which position will it be in?
7
3
9
4
What is its wort case time complexity of Heap sort?
O(n)
O(n2)
O(nlogn)
O(1)
Which sorting algorithm will take least time when all elements of input array are identical? Consider typical implementations of sorting algorithms.
Heap Sort
Merge Sort
Insertion Sort
A max-heap is a heap where the value of each parent is greater than or equal to the values of its children. Which of the following is a max-heap?
A
B
D
C
