ds-3marks
ds-3marks
3-Marks Questions
integer
float Arrays list Files
pointer one dimensional
reference
Two dimensional linear datastructure Non linear datastructure
Stacks Tree
Multi-dimensional queues graphs
Linked list
14. What is stack? Mention the types of operations performed on the stack.
A stack is an ordered collection of items where the addition of new items and the
removal of an existing item always take place at the same end called TOP.
Operations performed on the stack: Stack( ),Push( ),Pop( ),Peek( ),isEmpty( ) ,Size( )
15. Explain the memory representation of a stack using one dimensional array.
A stack is an ordered collection of items where the addition of new items and the
removal of existing items always take place at the same end called TOP.
Stack can be represented using one dimensional array. The items of stack are stored
in a sequential order from the first location of the memory block.
A pointer TOP contains the location of the top element of the stack.
The condition TOP= MAXSTK indicates the stack is full & it represents the
situation is called overflow.
The condition TOP=NULL indicates the stack is empty & it represents the
situation is called underflow.
10 20
20 20
10 10 10
Empty stack 20 will be removed first
10 20 30
0 1 2 3 4