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

What is difference between static and dynamic array?

530


What is a hashmap in c?

568


Which language is best to learn data structures?

648


What is a stable sorting algorithm?

659


What is the difference between binary tree and binary search tree?

594






Why do we need algorithm?

563


How do I sort a hashmap key?

572


What do you mean by hash table?

636


Why is reflection slower?

616


What is push and pop in stack?

494


What is an example of an algorithm?

571


How does hashset maintain order?

591


Why we use linked list?

590


Is vector a collection?

542


Is a hashmap a dictionary?

545