Home / Expert Answers / Computer Science / revise-the-pseudocode-quick-sort-provided-in-figure-14-10-to-sort-the-input-array-in-non-increas-pa778

(Solved): Revise the pseudocode (quick sort) provided in (Figure 14.10) to sort the input array in non-increas ...



Revise the pseudocode (quick sort) provided in (Figure 14.10) to sort the input array in non-increasing order. Only show the revised pseudocode (no programming required)
PARTITION (ARR, BEG, END, LOC)
Step 1: [INITIALIZE] SET LEFT = BEG, RIGHT = END, LOC \( =B E G \), FLAG \( = \)
Step 2: Repea

PARTITION (ARR, BEG, END, LOC) Step 1: [INITIALIZE] SET LEFT = BEG, RIGHT = END, LOC , FLAG Step 2: Repeat Steps 3 to 6 while FLAG Step 3: Repeat while ARR[LOC] \&= ARR[RIGHT] AND LOC != RIGHT SET RIGHT RIGHT -1 [END OF LOOP] Step 4: IF LOC RIGHT SET FLAG ELSE IF ARR[LOC] ARR[RIGHT] SWAP ARR[LOC] with ARR[RIGHT] SET LOC = RIGHT [END OF IF] Step 5: IF FLAG Repeat while ARR[LOC] >= ARR[LEFT] AND LOC != LEFT SET LEFT LEFT +1 [END OF LOOP] Step 6: IF LOC LEFT SET FLAG ELSE IF ARR[LOC] < ARR[LEFT] SWAP ARR[LOC] with ARR[LEFT] SET [END OF IF] [END OF IF] Step 7: [END OF LOOP] Step 8: END QUICK_SORT (ARR, BEG, END) Step 1: IF (BEG < END) CALL PARTITION (ARR, BEG, END, LOC) CALL QUICKSORT (ARR, BEG, LOC - 1) CALL QUICKSORT (ARR, LOC + 1, END) [END OF IF] Step 2: END Figure 14.10 Algorithm for quick sort


We have an Answer from Expert

View Expert Answer

Expert Answer


We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe