Algos
Algos
Algo 11 (Stack)
Push(stack , top, Maxstk, item)
1. If top = Maxstk , then print “Overflow” and return
2. Else Set top = top + 1
3. Set stack[top] item
4. Return
Pop(stack, top ,item)
1. If top =0 then print “underflow” and return
2. Set item = stack [top]
3. Set top = top -1
4. Return
Algo 12 (Quick)
Quick(A,n,beg,end,loc)
1. Set left = beg, right = end, and loc= beg
2. Repeat while A[loc] <= A[right] and loc !=right
a) right = right -1
End of loop
b) if loc = right then return
c) if A[loc] > A[right]
interchange A[loc] and A[right]
set loc = right
go to step 3
end of if
3. a) Repeat while A[left]<= A[loc] and left != loc then , left = left + 1(end of loop)
b. if loc = left ,then return
c) if A[left] > A[loc] , then
interchange A[left] and A[loc]
set loc = left
Go to step 2
End of if, End of Quick