An array that is first 7-sorted, then 5-sorted becomes . . . . . . . .
A. 7-ordered
B. 5-ordered
C. both 2-ordered and 5-ordered
D. both 7-ordered and 5-ordered
Select an option to see the answer and solution.
How many recursive statements are used in the algorithm of stooge sort?
Select an option to see the answer and solution.
In how many comparisons does the array arr={1, 4, 2, 3, 5} gets sorted if we use sleep sort?
Select an option to see the answer and solution.
What is the worst case time complexity of introsort?
A. O(n)
B. O(n log n)
C. O(n2 )
D. O(log n)
Select an option to see the answer and solution.
Which of the following is correct with regard to insertion sort?
A. insertion sort is stable and it sorts In-place
B. insertion sort is unstable and it sorts In-place
C. insertion sort is stable and it does not sort In-place
D. insertion sort is unstable and it does not sort In-place
Select an option to see the answer and solution.
What is the space complexity of in place merge sort?
A. O(1)
B. O(n)
C. O(log n)
D. O(n log n)
Select an option to see the answer and solution.
Sleep sort works by . . . . . . . .
A. making elements to sleep for a time that is proportional to their magnitude
B. making elements to sleep for a time that is inversely proportional to their magnitude
C. partitioning the input array
D. dividing the value of input elements
Select an option to see the answer and solution.
Heap sort is faster than Shell sort.
Select an option to see the answer and solution.
Statement 1: In insertion sort, after m passes through the array, the first m elements are in sorted order.
Statement 2: And these elements are the m smallest elements in the array.
A. Both the statements are true
B. Statement 1 is true but statement 2 is false
C. Statement 1 is false but statement 2 is true
D. Both the statements are false
Select an option to see the answer and solution.
What is the average time complexity of randomized quick sort?
A. O(n log n)
B. O(n2 )
C. O(n2 log n)
D. O(n log n2 )
Select an option to see the answer and solution.
There is a one line error in the following routine. Find that line.
1. int Max(int a[], int n)
2. {
3. int mi, i;
4. for (mi = 0, i = 0; i < n; i++)
5. if (a[i] > a[mi])
6. mi = i;
7. return mi;
8. }A. Line 2
B. Line 4
C. Line 6
D. Line 5
Select an option to see the answer and solution.
What is the worst case time complexity of randomized quicksort?
A. O(n)
B. O(n log n)
C. O(n2 )
D. O(n2 log n)
Select an option to see the answer and solution.
What is the time taken to copy elements to and from two arrays created for deletion?
A. O(N)
B. O(N log N)
C. O(log N)
D. O(N2 )
Select an option to see the answer and solution.
Which of the following is not true about bucket sort?
A. It is a non comparison based integer sort
B. It is a distribution sort
C. It can also be considered as comparison based sort
D. It is in place sorting algorithm
Select an option to see the answer and solution.
What is the worst case time complexity of permutation sort?
A. O(n2 )
B. O(n*n!)
C. O(infinity)
D. O(n log n)
Select an option to see the answer and solution.
Pigeonhole sort is a stable sorting algorithm.
Select an option to see the answer and solution.
What is the average number of inversions in an array of N distinct numbers?
A. N(N-1)/4
B. N(N+1)/2
C. N(N-1)/2
D. N(N-1)/3
Select an option to see the answer and solution.
Cocktail sort uses which of the following methods for sorting the input?
A. selection
B. partitioning
C. merging
D. exchanging
Select an option to see the answer and solution.
Which of the following is Python's standard sorting algorithm?
A. quick sort
B. introsort
C. merge sort
D. tim sort
Select an option to see the answer and solution.
The given array is arr = {2, 3, 4, 1, 6}. What are the pivots that are returned as a result of subsequent partitioning?
A. 1 and 3
B. 3 and 1
C. 2 and 6
D. 6 and 2
Select an option to see the answer and solution.