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
Where is data structure used?
What is the time complexity of arraylist and linked list?
State the rules to be followed during infix to postfix conversions?
How to excel in data structures and algorithms?
What is Jagged Arrays?
what are the applications of Linked Lists?
What are the disadvantages of linear list?
Why is sorting necessary?
Is complete binary tree?
Differentiate between arraylist and linkedlist.
Which is faster hashmap or hashtable?
Why do we use sorting?
Can we add heterogeneous elements into treemap?
Explain the difference between a list and array.
Why is arraylist not thread safe?