Floral Background Design
GITAM UNIVERSITY
Saturday, August 7, 2010
Saturday, July 24, 2010
QUICK SORT TECHNIQUE WITH LIST OF ELEMENTS
Full example of quicksort on a random set of numbers. The boxed element is the pivot. It is always chosen as the last element of the partition. However, always choosing the last element in the partition as the pivot in this way results in poor performance (O(n2)) on already sorted lists, or lists of identical elements. Since sub-lists of sorted / identical elements crop up a lot towards the end of a sorting procedure on a large set, versions of the quicksort algorithm which choose the pivot as the middle element run much more quickly than the algorithm described in this diagram on large sets of numbers.
QUICK SORT TECHNIQUE WITH DIAGRAM
| Visualization of the quicksort algorithm. The horizontal lines are pivot values. | |
| Class | Sorting algorithm |
|---|---|
| Worst case performance | |
| Best case performance | |
| Average case performance | |
| Worst case space complexity | |
Subscribe to:
Posts (Atom)