what is quick sort:-
Quick sort is one of the most efficient sorting technique because it is work on divide and conquer method.
–> the Quick sort algorithm work by partitioning the array to be sorted.
Here A is the array with N elements . Parameters BEG and END contain the boundary values of the sublist of A to which this procedure applies . LOC keeps track of the position of the first element A[BEG] of the sublist during the procedure . The local variables
LEFT and RIGHT will contain the boundary value of the list of elements that have not been scanned.
1. Set LEFT=BEG ,RIGHT=END and LOC=BEG
2. Scan from Right to Left
(a). Repeat while A[LOC]<=A[RIGHT] and LOC!=RIGHT
(b). If LOC==RIGHT then Return .
(c). If A[LOC]>A[RIGHT] then
(i). Interchange A[LOC] and A[RIGHT]
(ii). Set LOC=RIGHT
(iii). Go to step 3
3. Scan from left to right
(a). Repeat while A[LEFT]<=A[LOC] and LOC!=LEFT
(b). If LEFT==LOC then Return.
(c). If A[LEFT]>A[LOC] then
(i). Interchange A[LOC] and A[LEFT]
(ii). Set LOC=LEFT
(iii). GO to step 2