The Java Course provides a general introduction to programming in Java. It is based on A.B. Downey's book, How to Think Like a Computer Scientist. Click here for details. |
![]() |
Home ![]() ![]() |
||
See also: Array Implementation of the Stack Adt, The Java Stack Object | ||
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
||
The Stack ADT
In this chapter we will look at one common ADT, the stack. A stack is a collection, meaning that it is a data structure that contains multiple elements. Other collections we have seen include arrays and lists. As I said, an ADT is defined by the operations you can perform on it. Stacks can perform only the following operations:
A stack is sometimes called a "last in, first out," or LIFO data structure, because the last item added is the first to be removed.
|
||
Home ![]() ![]() |