Which sorting algorithm perform in least time in the worst case?
Answers
Answered by
2
Answer:
either merge sort or heap sort
Answered by
0
Quick sort is an efficient algorithm. It works on portioning of array to smaller chunks of array. The value which splits the whole array in to two is called a “pivot”. There is an algorithm for partitioning values.
1 : Choose a pivot value as the highest index
2: Take two variable to hold the left most which is the low index and right most to point to the high index
3: Value less than pivot is moved right and value greater than pivot is moved to left
4: If step 3 does not satisfy, swap the values
5: To obtain a new pivot value, the condition should be left>=right
This algorithm will perform in least time in the worst case.
Similar questions