What is ADT? Discuss stack as an ADT.

Answers

This answer is not selected as best answer. This answer may not be sufficient for exam.

Your limit has been exceed. We have implemented this system because, We got difficulty on managing our servers. Please donate some amount to remove this limit.

Quota: 0 / 30

Donate

Abstract data types are a set of data values and associated operations that are precisely independent of any particular implementation. Generally the associated operations are abstract methods. E.g. stack, queue etc.

Stack as an ADT

stack of elements of type is a finite sequence of elements of together with the operations

  1. Create Empty Stack(S): Create stack S which is initially an empty stack
  2. Push (S, x): Insert x at one end of stack, called it’s top
  3. Top(S): If stack is not empty then retrieve the element at its top.
  4. Pop(S): If stack S is not empty then delete the element from its top
  5. isFull(S): Determine whether the stack S is full or not. Return true if stack is full otherwise return false.
  6. isEmpty(S): Determine whether the stack S is empty or not. Return true if stack is empty otherwise return false.

Thus by using a stack we can perform above operations thus a stack acts as an ADT.

If you found any type of error on the answer then please mention on the comment or submit your new answer.
Leave your Answer:

Click here to submit your answer.

Discussion
0 Comments
  Loading . . .