# HackerRank Divide and Conquer Quiz-2

Question 1

Time: 00:00:00
The following algorithm is related to :-

PrepSort(arr[], low, high)
{
if (low < high)
{
indexPI = partition(arr, low, high);
PrepSort(arr, low, indexPI - 1);
PrepSort(arr, indexPI + 1, high);
}
}

quick sort

quick sort

Heap sort

Heap sort

merge sort

merge sort

bubble sort

bubble sort

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 2

Time: 00:00:00
Which approach is used by Quick sort of the following to implement sorting?

partition

partition

merge

merge

sort

sort

exchange

exchange

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 3

Time: 00:00:00
The following pseudo-code related to which algorithm:-

partition (arr[], low, high)
{
pivot = arr[high];
swapIndex = (low - 1)
for (j = low; j <= high- 1; j++)
{
if (arr[j] < pivot)
{
i++;
swap arr[j] and arr[swapIndex]
}
}
swap arr[swapIndex + 1] and arr[high])
return (swapIndex + 1)
}

Merging of merge sort

Merging of merge sort

partition of quick sort

partition of quick sort

merging of quick sort

merging of quick sort

none

none

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 4

Time: 00:00:00
Which algorithm isn't consistent in the given below?

Merge sort

Merge sort

Insertion sort

Insertion sort

Quick sort

Quick sort

Binary search

Binary search

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 5

Time: 00:00:00
Which is Merge Sort 's best, worst-case and average time complexity?

O(n2)

O(n2)

O(nlog n)

O(nlog n)

O(log n)

O(log n)

O(n)

O(n)

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 6

Time: 00:00:00
The complexity of the worst-case binary search suits with

linear search

linear search

selection sort

selection sort

quick sort

quick sort

merge sort

merge sort

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 7

Time: 00:00:00
Which is the real intention of using a three quick median over standard quick sort?

avoid worst-case time complexity

avoid worst-case time complexity

avoid worst-case space complexity

avoid worst-case space complexity

to improve the accuracy of the output

to improve the accuracy of the output

to improve the accuracy of the input

to improve the accuracy of the input

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 8

Time: 00:00:00
What of the binary search method does not require more than ______compare?

(logn) + 1

(logn) + 1

(2log2n) + 1

(2log2n) + 1

(logn) + 2

(logn) + 2

(log2n) + 1

(log2n) + 1

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 9

Time: 00:00:00
Which one of the mentioned sorting algorithms do not have O(n2) running time in the worst case?

Quick sort

Quick sort

Merge sort

Merge sort

Insertion sort

Insertion sort

Bubble sort

Bubble sort

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 10

Time: 00:00:00
Quick Sort also recognized as-

partition-exchange sort

partition-exchange sort

merge-exchange sort

merge-exchange sort

Both

Both

None

None

Once you attempt the question then PrepInsta explanation will be displayed.