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
Is selection sort greedy?
Why do we use arrays?
Why is hashmap faster than arraylist?
How can you insert a node to the beginning of a singly linked list?
Define non-linear data structures?
Are hash tables ordered?
What are the two traversal strategies used in traversing a graph?
Why is quicksort faster than merge sort?
What is the structure of an array?
What is the best complexity of bubble sort?
Explain what is binary search?
What is unmodifiable list?
What is adt in data structure with example?
Why null is not allowed in treemap?
When will we get ArrayStoreException?