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 is sequential mapping in data structure?
Is data structure a data type?
Questions related to arrays, such as given a 2 integer array, find the common elements.
Why quicksort is better than merge sort?
What is long data type?
Can you sort a hashset?
How to excel in data structures and algorithms?
Tell me what should be done in the base case for this recursive problem?
what is the difference between singly and doubly linked lists?
What is the difference between dictionary and hashtable?
What is difference between rb tree and avl tree?
How does max heap work?
What is the difference between a stack and an array?
Define a set?
Which is faster binary or linear search?