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
How many parts are there in a declaration statement?
What is the use of space complexity and time complexity?
Define binary tree insertion.
Which sorting algorithm is worst?
Is array a collection?
What is Doubly link list?
How do you use the sort function?
How null key is handled in hashmap?
In depth questions regarding the data structures and the Databases used in the Projects developed.
How many types of priority queue are there?
Which sorting is best in time complexity?
Explain what are the major data structures used in the network data model?
What is an array vs list?
Can arraylist have null values?
Name few collections map implementations?