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
What is data and data structure?
What are the categories of avl rotations?
What is static array?
What is entryset in hashmap?
Can we null keys in treemap?
What is minimum depth of binary tree?
Is any implicit arguments are passed to a function when it is called?
What are the advantages of selecetion sort?
What are the advantages of data structure?
What happens in insertion sort?
Tell me is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
Difference between hashset and treeset?
Is array size dynamic or fixed?
What are doubly linked lists?
What is a data structure? What are the types of data structures?