0 0 votes You are asked to sort 15 randomly generated numbers. You should prefer A. bubble sort B. Selection sort C. Insertion sort D. Quick sort Ans is given as Bubble sort. How it is selected..please explain Algorithms + – sh!va 8.9k views answer comment Share Follow Print See all 2 Comments 2 2 Comments reply Sanjay Sharma commented Jul 1, 2016 i edited by Sanjay Sharma Oct 24, 2018 reply Follow flag clearly problem has nothing to do with complexity as all almost have more or less same and it is u not machine that will sort quite naturally one will not apply quick sort(first one have to understand it which itself is not easy) insertion sort is best applicable when u can physically replace number (like in arranging cards) selection sort is again not preferred for the same reason bubble sort is best option as the 1)it is quite natural to adopt ,2) size of list is not large so swaps will not be issue and 3)it will give u partial sorted list in first few passes thats what i think correct me if i am wrong 0 0 replyShare gauravkc commented Jul 5, 2016 reply Follow flag why not quick sort ? Since they are randomly generated probably very few will be same. Quick sort works best on few elements in the array and non-repeating numbers. 2 2 replyShare Please log in or register to add a comment.
0 0 votes For sorting 15 randomly generated numbers, Insertion sort is considered the best option due to its simplicity, efficiency, and in-place sorting. While Bubble sort, Selection sort, and Heap sort can also sort the numbers, they may not be as efficient as Insertion sort for this specific case. However, the choice of sorting algorithm can depend on various factors such as the nature of the input, the size of the input, and specific requirements of the use case. Sandeep652025 answered Nov 3, 2023 Sandeep652025 comment Share Follow 0 reply Please log in or register to add a comment.