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
Explain quick sort and merge sort algorithms.
What is the similarity between a Structure, Union and enumeration?
What is a weighted graph?
how to add an item to the beginning of the list?
What is array and its types?
How would you sort words in a large file?
Give the example of validating the parenthesis of expression using stack.
How to use appendNode() in linkedlist()?
What is a string array?
What is circular linked list?
Explain about set and their types in a collection?
What is static array?
What is red black tree in data structure?
What are the main differences between the linked list and linear array?
What is difference between hashmap and hashtable?