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
Differentiate linear from a nonlinear data structure?
State the different ways of representing expressions?
What is a matrix? Explain its uses with an example
Which sorting is best?
Define secondary clustering?
Tell me why might quick sort might be better than merge sort?
What is complexity of bubble sort?
Can treemap have duplicate values?
What is a singletonlist?
Is null allowed in list?
Define general trees?
Calculate the address of a random element present in a 2d array, given base address as ba.
State the difference between primitive and non-primitive data types?
Define threaded binary tree. Explain its common uses
How to find if linked list has loop?