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
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.
How is hashmap o 1?
What are the advantages of bubble sort?
What is the difference between length () and size () of arraylist?
Differentiate between hashset and hashmap.
What is hashing technique?
What is binary tree? Explain its uses.
What are the disadvantages of sequential storage?
How do you initialize an arraylist?
Define a full binary tree ?
What is complete binary tree in data structure?
Define hashing?
List out the advantages of using a linked list?
What does enum do?
Different Types of pattern?