An Abstract Data type is an mathematical model of an data type where the data type is defined by it's possible values, possible operations on the data of this type and the behaviour of these operations. An ADT is an class of object whose logical behaviour is defined by the set of possible values and the set of operations that can be perfomed.
Stack as an adt:
Stack can be defined as an ADT by the following operations:
CreateEmptyStack(S): Creates an empty stack S
Push(s,x): Inserts or pushes an element x at the top of the stack
Pop(S): Pops or removes the top element of stack
Top(S): retrieves the element at the top of the stack
IsEmpty(S): returns an true value if the stack is empty i.e. in stack underflow condition else retruns false
IsFull(S): returns an true value in stack overflow condition i.e. when stack is full, else false
No comments:
Post a Comment