The way a card game player arranges his cards as he picks them up one by one, is an example of
It is done only by insertion sort because in insertion sort we compare the one card to another all inserted card.
You want to check whether a given set of items is sorted. Which of the following sorting methods will be the most efficient if it is already is sorted order?
if we want to check if given input is sort or not then one pass of bubble sort and n pass of insertion sort with each has work of O(1) are best i.e.take O(n) time.
Which of the following sorting methods will be the best if number of swappings done, is the only measure of efficiency?
If number of swapping is the measure of efficiency of algorithm the selection sort is best since it cannot take swap more than O(n).
You are asked to sort 15 randomly generated numbers. You should prefer
In-order traversal of a Binary Search Tree lists the nodes in ascending order.
As part of the maintenance work, you are entrusted with the work of rearranging the library books in a shelf in proper order, at the end of each day. The ideal choice will be
Rearranging the library books in a shelf in proper order is same as arranging cards. So insertion sort should be preferred.
Which of the following algorithms exhibits the unnatural behaviour that, minimum number of comparisons are needed if the list to be sorted is in the reverse order and maximum number of comparisons are needed if they are already in sorted order?
Binary insertion sort take minimum comparison if the list to be sorted is in reverse order and maximum number of comparison if they already in sorted order.
Which of the following sorting methods sorts a given set of items that is already in sorted order or in reverse sorted order with equal speed?
Quick sort has two worst cases, when input is in either ascending or descending order, it takes same time O(n2).
Which of the following algorithm design technique is used in the quick sort algorithm?
Quick sort algorithm uses divide and conquer technique. It divides the data set every time on pivot element and keep on sorting each data set recursively.
A binary search tree contains the values -1, 2, 3, 4, 5, 6, 7 and 8. The tree is traversed in preorder and the values are printed out. Which of the following sequences is a valid output?
Preorder is root, left, right.
Which of the following also called "diminishing interment sort"?
The shell sort sometimes called the “diminishing increment sort" improves on the insertion sort by breaking the original list into a number of smaller sub list each of which is sorted using an insertion sort.