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

Answer Posted / soumitra biswas

modified bubble sort with flag.As the array is already sorted
there will be no swapping in first pass,so no comparison
will take place after first pass and program stops executing.
time complexity =0(n).

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can a hashset contain duplicates?

488


What are the disadvantages of circular list?

501


Is stack a dynamic data structure?

489


in tree construction which is the suitable efficient data structure? (Array, linked list, stack, queue)

765


Why is quicksort not stable?

451






Which sorting is best for large data?

497


Which sort is best for linked list?

498


How do you use the sort function?

473


What is advantage and disadvantage of linked list?

460


State the demerit of linear representation of binary trees?

481


What is list and types of list?

473


Can we use ordered set for performing binary search?

543


What is default array size?

562


What is difference between hashmap and hashtable?

459


What are different types of linked lists?

474