Rev Mid
Rev Mid
Mergesort
List the steps to sort the following number using insertion sort
List the steps to sort the following number using bubble sort
List the steps to sort the following number using quick sort
4 3 6 9 2 4 3 1 2 1 8 9 3 5
What will be the number of passes to sort the elements using insertion sort? 14, 12,16,
6, 3, 10
a) 6
b) 5
c) 7
d) 1
Using insertion-sort, how will the array elements look like after second pass? 34, 8, 64,
51, 32, 21
a) 8, 21, 32, 34, 51, 64
b) 8, 32, 34, 51, 64, 21
c) 8, 34, 51, 64, 32, 21
d) 8, 34, 64, 51, 32, 21
If the average time for searching a list of 800 elements is 2.1 microseconds using
Binary search, what is the expected average time for searching a list of 1600
elements.
a. 2.8
b. 8.4
c. 4.2
d. 6.3
The given array is arr = {2,6,1}. What are the pivots that are returned as a
result of subsequent partitioning?
a) 1 and 6
b) 6 and 1
c) 2 and 6
d) 1
The largest number of comparisons for searching in a sorted list using Binary
search for a list that contains 280 elements is.
a. 6 times
b. 7 times
c. 8 times
d. 9 times
If we are sorting a list of 300 elements using Selection sort, and it took 2.4
microseconds, how long does it take to sort a list of 600 elements.
a. 4.8 ms
b. 9.6 ms
c. 7.2 ms
d. 12 ms
The given array is arr = {3,4,5,2,1}. The number of iterations in bubble sort and
selection sort respectively are,
A. 5 and 4
B. 4 and 5
C. 2 and 4
D. 2 and 5
The given array is arr = {1,2,3,4,5}. (bubble sort is implemented with a flag variable)
The number of iterations in selection sort and bubble sort respectively are
……………………
A. 5 and 4
B. 1 and 4
C. 0 and 4
D. 4 and 1
1) O(n)
2) O(n log n)
3) O(n^2)
4) O(n^2 log n)
1) O(n)
2) O(n log n)
3) O(n^2)
4) O(n^2 log n)
Answer: O(1)
1. n
2. (n+1)
3. n(n-1)
4. n(n+1)