MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
If the number of records to be sorted is small, identify the suitable sorting to be used
A
Quick sort
B
Merge sort
C
Selection sort
D
Bubble sort
Explanation: 

Detailed explanation-1: -Solution. If the number of records to be sorted is small, then selection sorting can be efficient. Explanation: The selection sort method sorts an array by repeatedly finding the smallest element (in ascending order) from the unsorted segment and inserting it at the start.

Detailed explanation-2: -Insertion Sort If the data is nearly sorted or when the list is small as it has a complexity of O(N2) and if the list is sorted a minimum number of elements will slide over to insert the element at its correct location. This algorithm is stable and it has fast running case when the list is nearly sorted.

Detailed explanation-3: -Quicksort is one of the most efficient sorting algorithms, and this makes of it one of the most used as well. The first thing to do is to select a pivot number, this number will separate the data, on its left are the numbers smaller than it and the greater numbers on the right.

Detailed explanation-4: -Insertion sort is widely used for small data sets, while for large data sets an asymptotically efficient sort is used, primarily heapsort, merge sort, or quicksort.

Detailed explanation-5: -Answer: N-1 passes, N-number of elements.

There is 1 question to complete.