Contents    Page-10    Prev    Next    Page+10    Index   

Quicksort Example


Quicksort:  lo 0  hi 9   [32, 29, 62, 75, 48, 14, 80, 98, 28, 19]
Partition:   i 5   j 4   [32, 29, 19, 28, 14, 48, 80, 98, 75, 62]
Quicksort:  lo 0  hi 4   [32, 29, 19, 28, 14]
Partition:   i 2   j 1   [14, 19, 29, 28, 32]
Quicksort:  lo 0  hi 1   [14, 19]
Partition:   i 1  j -1   [14, 19]
   sorted:  lo 0  hi 1   [14, 19]
Quicksort:  lo 2  hi 4           [29, 28, 32]
Partition:   i 3   j 2           [28, 29, 32]
Quicksort:  lo 3  hi 4               [29, 32]
Partition:   i 4   j 2               [29, 32]
   sorted:  lo 3  hi 4               [29, 32]
   sorted:  lo 2  hi 4           [28, 29, 32]
   sorted:  lo 0  hi 4   [14, 19, 28, 29, 32]
Quicksort:  lo 5  hi 9                       [48, 80, 98, 75, 62]
Partition:   i 9   j 8                       [48, 80, 62, 75, 98]
Quicksort:  lo 5  hi 8                       [48, 80, 62, 75]
Partition:   i 8   j 7                       [48, 75, 62, 80]
Quicksort:  lo 5  hi 7                       [48, 75, 62]
Partition:   i 7   j 6                       [48, 62, 75]
Quicksort:  lo 5  hi 6                       [48, 62]
Partition:   i 6   j 4                       [48, 62]
   sorted:  lo 5  hi 6                       [48, 62]
   sorted:  lo 5  hi 7                       [48, 62, 75]
   sorted:  lo 5  hi 8                       [48, 62, 75, 80]
   sorted:  lo 5  hi 9                       [48, 62, 75, 80, 98]
   sorted:  lo 0  hi 9   [14, 19, 28, 29, 32, 48, 62, 75, 80, 98]