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
Can we store null in arraylist?
Explain the difference between a list and array.
Explain the expression trees?
What are the best data structure courses for gate preparation?
What is array in data structure with example?
What do you mean by data types?
How do you sort an array in descending order?
Why is an array homogeneous?
What is different between array and list?
What is an ordered map?
What is worst case complexity algorithm?
What is difference between hashmap and linkedhashmap?
Define an algorithm. What are the properties of an algorithm? What are the types of algorithms?
What is collections singletonlist?
Which interfaces are implemented by concurrentskiplistset?