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 dynamic array how it is created?
What is the use of placement new?
What are data and data types?
What do you mean by balanced trees?
What is the difference between hashset and hashmap?
Model a data structure for a DFA that takes an event as parameter and performs a desired action.
Define adjacent nodes?
Is an arraylist a vector?
Is treeset thread safe?
List out a few of the applications that make use of Multilinked Structures?
What is the purpose of sorting algorithms?
Is array a data structure?
Define threaded binary tree. Explain its common uses
Two linked lists are given, find out the sum of them without altering the linked list?
Why is selection sort used?