Professional Documents
Culture Documents
Operation Push
Method 1. begin
2. if top = n then stack full
3. top = top + 1
4. stack (top) : = item;
5. end
Operation Pop
Method 1. begin
2. if top = 0 then stack empty;
3. item := stack(top);
4. top = top - 1;
5. end;
Operation Peek
Method 1. Begin
2. if top = -1 then stack empty
3. item = stack[top]
4. return item
5. End