Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between partition sort and quick sort?

What is the difference between partition sort and quick sort?

like image 834
tony Avatar asked Oct 13 '09 14:10

tony


People also ask

Why quick sort is called Partition sort?

Quicksort is a divide-and-conquer algorithm. It works by selecting a 'pivot' element from the array and partitioning the other elements into two sub-arrays, according to whether they are less than or greater than the pivot. For this reason, it is sometimes called partition-exchange sort.

What is the difference between quick sort and merge sort?

The quick sort is internal sorting method where the data is sorted in main memory. The merge sort is external sorting method in which the data that is to be sorted cannot be accommodated in the memory and needed auxiliary memory for sorting.

What is the difference between quick sort and heap sort?

Quicksort is commonly used in practice because it's faster, but Heapsort is used when memory usage is a concern.

How many times partition is called in quick sort?

Partition is called n times – The pivot element x is not included in any recursive calls. One call of Partition takes O(1) time plus time proportional to the number of iterations of FOR-loop.


1 Answers

Quicksort is a Partitioning Sorting Algorithm, you might refer to Mergesort which also is a Partitioning Sorting Algorithm, the biggest difference is probably the speed, Quicksort is faster even though both of them are O(n*log(n)).

Quicksort uses a Pivot element for its sorting and MergeSort divides & conquers. Both however are in-place sorting algorithms, which means they don't use any extra memory when sorting.

like image 155
Filip Ekberg Avatar answered Oct 13 '22 04:10

Filip Ekberg