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

Answer Posted / sathyanarayana

Yes, its insertion sort. For a sorted array, it takes just
O(n) time. iTs mere traversal of an array as it is already
sorted. In the case of quick sort, it boils down to O(n^2)
in the case of sorted array.

Is This Answer Correct ?    5 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

A lot of data structures related programs related to only trees and graphs, like the diameter of a tree, removing the loops in a graph etc.

521


How is hashmap o 1?

484


What are the advantages of bubble sort?

472


What is the difference between length () and size () of arraylist?

452


Differentiate between hashset and hashmap.

512






What is hashing technique?

539


What is binary tree? Explain its uses.

507


What are the disadvantages of sequential storage?

731


How do you initialize an arraylist?

491


Define a full binary tree ?

530


What is complete binary tree in data structure?

515


Define hashing?

580


List out the advantages of using a linked list?

500


What does enum do?

505


Different Types of pattern?

556