Some terminology about the stack: or data members of stack class
Stacks
Term
|
Meaning
|
Top
|
It is a user defined variable of stack class.
|
Top=-1
|
Stack is empty
|
Top=size-1
|
Stack is full
|
Size
|
Size of an stack
|
Push()
|
Inserting data into the stack, use top++ to insert
|
Pop()
|
Deletion from the stack, use top- -to delete
|
S
|
It is a poiner of stack class, which points to the run time stack
|
Top++
|
Inserting a value, first increment top by 1, then insert a value in
to the stack
|
Top- -
|
To delete a value from the stack, first decrement the top by 1 , so
value is deleted logically
|
S[top]
|
To display last inserted value
|
Stacks
No comments:
Post a Comment