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 a weighted graph?
How is a hashset implemented?
Why is treeset sorted?
What is the difference between for and foreach loop?
List the basic operations carried out in a linked list?
Draw the B-tree of order 3 created by inserting the following data arriving in sequence – 92 24 6 7 11 8 22 4 5 16 19 20 78
What is the difference between adt and data structure?
What is the top of a stack?
What are linked lists used for?
If we try to add duplicate key to the hashmap, what will happen?
Define distributed query and linked server?
What is the difference between array and stack in data structures?
Is array a data type?
Why is quicksort unstable?
Can array store heterogeneous data?