COMPUTER SCIENCE AND ENGINEERING
ALGORITHMS
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
2, 5, 3, 1, 7, 9
|
|
5, 2, 1, 3, 7, 9
|
|
Either A or B
|
|
None of the above
|
Detailed explanation-1: -1. How many comparisons will be made to sort the array arr=1, 5, 3, 8, 2 using counting sort? Explanation: As counting sort is an example of non comparison sort so it is able to sort an array without making any comparison.
Detailed explanation-2: -In other words, Selection Sort first finds the largest key in an unsorted list, then the next largest, and so on.
Detailed explanation-3: -Most sorting algorithms are comparison sorts, i.e. they sort a list just by comparing the elements to one another. A comparison sort algorithm cannot beat (worst-case) running time, since represents the minimum number of comparisons needed to know where to place each element.
Detailed explanation-4: -Insertion sort, Bubble sort and Selection sort are comparison based sorting algorithms.