No student devices needed. Know more
15 questions
Choose a CORRECT statement about pivot in quick sort method.
A pivot divides the list evenly.
A pivot can be chosen randomly.
A pivot is chosen by using a formula
A pivot makes the searching method becomes slow
Identify the INCORRECT statement about searching
i. Binary search starts by testing the largest data
ii. Linear search can be done for unsorted data only
iii. Linear search starts by testing data at the middle of list
iv. Binary search can be done for sorted homogeneous data
i, ii and iii
ii, iii and iv
i, iii and iv
i, ii, iii and iv
Suppose a list is {2, 9, 5, 4, 8, 1}. After the first phase of bubble sort, the list becomes …
2, 9, 5, 4, 8, 1
2, 9, 5, 4, 1, 8
2, 5, 9, 4, 8, 1
2, 5, 4, 8, 1, 9
Given a list is {7, 4, 5, 9, 8, 2, 1}. After the first phase of selection sort, the list becomes …
1,2,4,9,8,5,7
1,2,5,9,8,4,7
1,4,5,9,8,2,7
7,4,5,9,8,2,1
If the number of records to be sorted is small, identify the suitable sorting to be used
Quick sort
Merge sort
Selection sort
Bubble sort
The worst case occurs in linear search algorithm when ______________________
Item is not in the array at all
Item is somewhere in the middle of the array
Item is the last element in the array or item is not there at all
Item is the last element in the array
Suppose we are sorting an array of eight integers using quick sort, and we have just finished the first partitioning with the array looking like this:
2 5 1 7 9 12 11 10
Identify the correct statement?
Neither the 7 nor the 9 is the pivot.
The pivot could be either the 7 or the 9.
The pivot is not the 7, but it could be the 9.
The pivot could be the 7, but it is not the 9.
How many swaps needed to sort the following numbers using a selection sort.
5 ,1 , 12 , -5 , 16 , 2 ,12 , 14
8
6
7
5
With a data set of 0,1,3,6,7,8,9
How many steps would a binary search take to find the value 8?
2
4
3
7
Which sorting algorithm is more efficient with longer lists of data?
Merge Sort
Bubble Sort
Both
Neither
Why might a sorting algorithm be needed before a search?
Data is better when ordered
Data always needs to be in order before searching
The search algorithm may be in the code before the sorting algorithm
The search algorithm may need the data to be in order
What is recurrence for worst case of QuickSort and what is the time complexity in Worst case?
Recurrence is T(n) = T(n-2) + O(n) and time complexity is O(n^2)
Recurrence is T(n) = T(n-1) + O(n) and time complexity is O(n^2)
Recurrence is T(n) = 2T(n/2) + O(n) and time complexity is O(nLogn)
Recurrence is T(n) = T(n/10) + T(9n/10) + O(n) and time complexity is O(nLogn)
Which of the following is NOT a stable sorting algorithm in its typical implementation.
Insertion sort
Bubble sort
Merge sort
Quick sort
None
You have to sort 1 GB of data with only 100 MB of available main memory. Which sorting technique will be most appropriate?
Heap Sort
Merge Sort
Quick Sort
All of the above
Identify the sorting algorithm that apply divide-and-conquer method.
Linear Sort
Merge Sort
Heap Sort
Binary Sort
Explore all questions with a free account