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
What's the difference between a hashtable and a hashmap?
How does a heap sort work?
What is a list of lists?
What is array simple?
Is a hashset ordered?
Differentiate between hashset and treeset.
What are the tasks performed during inorder traversal?
“int a[] = new int[3]{1, 2, 3}” – This a legal way of defining the arrays?
What is data structure and why we need it?
What is data structure and why we need them?
What is an algorithm in coding?
What is 2 dimensional linked list?
What is the complexity of selection sort?
Which is the simplest file structure?
How do you get placements?