A list is ordered from smaller to largest when a sort is
called. Which sort would take the longest time to execute?
Answers were Sorted based on User's Feedback
Answer / zeeshan
quick sort is the answer.....quick sort shows worst case
behaviour when the list is already sorted....
courtesy"" shaum series- data structures""
Is This Answer Correct ? | 15 Yes | 0 No |
Answer / uma sankar pradhan
selection sort,quick sort,bubble sort
(all will take the same time and its time complexity is of
the order of n^2)
the time complexity for insertion sort when the list is
ordered from smaller to larger is O(n)
the time complexity for merge sort irrespective of the
order of the elements is O(nlogn)
Is This Answer Correct ? | 16 Yes | 2 No |
Answer / udkl
Its Quick Sort !!!!!
Even I got Surpriced!!!
http://www.geocities.com/siliconvalley/network/1854/Sort1.
html
Is This Answer Correct ? | 13 Yes | 3 No |
Quick sort's worst case is the one given in the question.
It exhibits selection sort type of procedure when the list
is sorted
Hence both :)
Is This Answer Correct ? | 8 Yes | 0 No |
Answer / rahul
Bubble Sort cannot be the answer, Because the MODIFIED BUBBLE SORT takes complexity of O(n) when the elements are arranged in a particular order..
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / rahul
When the elements are ordered in either Ascending or Descending order, Quick sort behaves Equivalent to Merge sort. Time complexity of O(nlogn) is taken for sorting.
Is This Answer Correct ? | 1 Yes | 2 No |
Answer / ntrphanikumar
I am not sure about the answer.
But I think the answer is "Selection Sort" whose order is
O(n^2) irrespective of the elements order.
I guess all other sorts somehow depend on the order of elements.
Is This Answer Correct ? | 3 Yes | 6 No |
Can you tell me the differences between Array and ArrayList?
what is the difference between dynamic as well as non - dynamic data structures.
Is hashtable fail fast?
Define balanced trees?
What is a map in programming?
Define red-black trees.
What is the average number of comparisons in a sequential search?
List the data structures which are used in rdbms, network data modal, and hierarchical data model.
How many null values are allowed in a set?
Can we create a null as a key for a map collection?
What is a sorting algorithm in data structure?
What is the best sorting technique?