A list is ordered from smaller to largest when a sort is
called. Which sort would take the shortest time to execute?
Answer Posted / ronak & sandip
In this case, both insertion and bubble sort will work exactly same as the time complexity of both method is O(n). But you have to mention one condition to check any swap has been made inside or not...if no swap has been made, it will come out of loop after executing it n times.
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
How many types of searching are there in data structure?
What are the operations that can be performed on a stack?
What happens if an array goes out-of-bounds?
Can we put null key in hashmap?
Is priority queue sorted?
Tell me why might quick sort might be better than merge sort?
Is red black tree balanced?
How will you free the memory that is allocated at run time?
What is the difference between data type and data structure?
What is subtree?
What is worst case complexity algorithm?
Can we use Generics with the array?
Define heap?
Can you store different types in an array?
Explain what is a spanning tree?