Quick Sort
Step1: Start
Step2: Top=Null
Step3: if N>1 then set, Top=Top+1
Lower [1] = 1&Upper [1] =N
Step4: while Top≠ Null, Loop Step 5 & 8
Step5: Set, beg=Lower[Top], end=Upper[Top] &
Top=Top-1
Step6: call: Quick (A, N, beg, end, Loc )
Step7: if beg<Loc-1 then, Top=Top+1,
Lower[Top]=
beg & Upper[Top]=Loc-1
Step8: if end>Loc+1 then, Top=Top+1,
Lower[Top]=Top+1
& Upper[Top]=end
Step9: End
No comments:
Post a Comment