you are here->home->Class 12->Selection Sort
Selection Sort
 1) The best-case swaps required in the selection sort for n elements is _______.? 0 1 n n-1

 2) The worst-case swaps required in in the selection sort for n elements is ______.? n^2 n n-1 log n

 3) Consider the following list of numbers and what is the status of the list after the fifth pass when we use the selection sort? Input: 4, 3, 2, 10, 12, 1, 5, 6 1, 2, 3, 4, 10, 12, 5, 6 3, 4, 2, 10, 12, 1, 5, 6 1, 2, 3, 4, 5, 10, 12, 6 2, 3, 4, 10, 12, 1, 5, 6

 4) Which of the following best describes the key characteristic of the Selection Sort algorithm? It works by swapping adjacent elements until the array is sorted. It always maintains a sorted subarray and an unsorted subarray. It uses a divide-and-conquer approach. It has a time complexity of O(log n).

 5) Identify the correct statement from below, S1: append () adds only a single item or object at a time. S2: append () cannot use with list data structure. Only S1 is correct Only S2 is correct Neither S1 nor S2 is correct Both S1 and S2 are correct

 6) The len() function return _____. S1: returns the number of characters in the string. S2: returns the number of items in an object. Only S2 is correct Neither S1 nor S2 is correct Only S1 is correct Both S1 and S2 are correct

 7) What is the use of the statement “arr=[ ]“ Create a list of size 1. Checking whether the list named arr is empty. Create an empty list. Deleting the elements from the list.

 8) Selection sort is not a very efficient algorithm when data list is large. False True

 9) What is the output generated by the following code def selectionSort(array, size): for ind in range(size): min_index = ind for j in range(ind + 1, size): if array[j] > array[min_index]: min_index = j (array[ind], array[min_index]) = (array[min_index], array[ind]) arr = [-2, 45, 0, 11, -9, 88, -97, -202, 747] size = len(arr) selectionSort(arr, size) print(arr) [-2, -9, -97, -202, 747, 88, 45, 11, 0] [-202, -97, -9, -2, 0, 11, 45, 88, 747] [747, 88, 45, 11, 0, -2, -9, -97, -202] [-2, 45, 0, 11, -9, 88, -97, -202, 747]

 10) What is the advantage of selection sorting over other sorting techniques? It is faster than any other sorting technique. It requires no additional storage space. It works best for inputs which are already sorted. It is a stable sorting algorithm.