A list is ordered from smaller to largest when a sort is
called. Which sort would take the shortest time to execute?
Answer Posted / rohit
Bubble sort with a flag variable to check if comparisons
occur or not. If it is already sorted then in just 1
iteration it will show that the array is sorted which is
not possible in any other sort.THUS JUST 1 ITERATIION IS
REQUIRED IN THIS CASE.
| Is This Answer Correct ? | 27 Yes | 2 No |
Post New Answer View All Answers
What is data and information explain with example?
Define a Deque?
What is modcount in hashmap?
What is difference between rb tree and avl tree?
What is the difference between Array and Arraylist?
an array of size N in which every number is between 1 and N, determine if there are any duplicates in it. You are allowed to destroy the array if you like. [ I ended up giving about 4 or 5 different solutions for this, each supposedly better than the others ].
What are different types of algorithms?
State the merits of linear representation of binary trees?
What is entryset in hashmap?
What is array and its types with example?
What are the different types of data structures?
Is heap sort adaptive?
Can you have an arraylist of arrays?
What is pivot in quicksort?
Can a stack be described as a pointer? Explain.