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
How do you find the index of an element in an arraylist?
Is a hashset ordered?
Which is better array or linked list?
What is space complexity of a program?
Mention for which header list, you will found the last node contains the null pointer?
How do you find the complexity of a bubble sort?
What is array and its types in data structure?
What is two-dimensional array?
What is a list in data structure?
Define a linear and non linear data structure.
Which is better stack or queue?
Define data type and what are the types of data type?
Can hashmap have duplicate keys?
Can arraylist store primitives?
What is a vector class?