A list is ordered from smaller to largest when a sort is
called. Which sort would take the shortest time to execute?

Answer Posted / rohit

Bubble sort with a flag variable to check if comparisons
occur or not. If it is already sorted then in just 1
iteration it will show that the array is sorted which is
not possible in any other sort.THUS JUST 1 ITERATIION IS
REQUIRED IN THIS CASE.

Is This Answer Correct ?    27 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Does hashmap sort automatically?

565


Can you please explain the difference between array_name and &array_name?

556


Which sort is best for linked list?

501


What are the advantages of binary search over linear search?

630


Can we add or delete an element after assigning an array?

666






How to get largest and smallest number in an array?

534


Is selection sort greedy?

513


What is treemap chart?

494


Differentiate between list and set.

624


What are the standard ways in which a graph can be traversed?

488


What is impact of signed numbers on the memory using data structures?

564


Explain what is the bucket size, when the overlapping and collision occur at same time?

581


What is merge sort and how it works?

491


Define collision in hashing?

496


Does map extend iterable?

458