Java Tuotorial: Abstract Data Type
What is an Abstract Data Type?
An abstract data type (ADT) is a collection of data elements provided with a set of operations that are defined on the data elements. Stacks, queues and binary trees are some examples of ADT. In this section, you will be learning about stacks and queues.
Java Tutorial: Stacks
A stack is a set of data elements wherein manipulation of the elements is allowed only at the top of the stack. It is a linearly ordered collection of data on which the discipline of “last in, first out” (LIFO) is imposed. Stacks are useful for a variety of applications such as pattern recognition and conversion among infix, postfix and prefix notations.
The two operations associated with stacks are the push and pop operations. Push simply means inserting at the top of the stack whereas pop refers to removing the element at the top of the stack. To understand how the stack works, imagine how you would add or remove a plate from a stack of plates. Your instinct would tell you to add or remove only at the top of the stack because otherwise, there is a danger of causing the stack of plates to fall.
The stack is full if the top reaches the cell labeled n-1. If the top is equal to -1, this indicates that the stack is empty.
Java Tutorial
What is an Abstract Data Type?
An abstract data type (ADT) is a collection of data elements provided with a set of operations that are defined on the data elements. Stacks, queues and binary trees are some examples of ADT. In this section, you will be learning about stacks and queues.
Java Tutorial: Stacks
A stack is a set of data elements wherein manipulation of the elements is allowed only at the top of the stack. It is a linearly ordered collection of data on which the discipline of “last in, first out” (LIFO) is imposed. Stacks are useful for a variety of applications such as pattern recognition and conversion among infix, postfix and prefix notations.
The two operations associated with stacks are the push and pop operations. Push simply means inserting at the top of the stack whereas pop refers to removing the element at the top of the stack. To understand how the stack works, imagine how you would add or remove a plate from a stack of plates. Your instinct would tell you to add or remove only at the top of the stack because otherwise, there is a danger of causing the stack of plates to fall.
The stack is full if the top reaches the cell labeled n-1. If the top is equal to -1, this indicates that the stack is empty.
Java Tutorial



