A list is ordered from smaller to largest when a sort is
called. Which sort would take the shortest time to execute?
Answer Posted / soumitra biswas
modified bubble sort with flag.As the array is already sorted
there will be no swapping in first pass,so no comparison
will take place after first pass and program stops executing.
time complexity =0(n).
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
What is the default size of an arraylist?
What are the types of map?
What is selection in an algorithm?
Difference between arraylist and linkedlist?
Which is better hashmap or arraylist?
Is hashmap a data structure?
How do you sort elements in an arraylist?
What is the difference between ienumerable and list?
How do you find the depth of a binary tree?
Explain the applications of stack?
How are the elements of a 2d array are stored in the memory?
Is hashset a collection?
Write a program for Sorting an Array. Which sorting will you prefer?
Is arraylist a collection?
What is a vector element?