Stack ADT

0.0(0)
Studied by 2 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play

1/11

encourage image

There are no tags or description

Looks like no tags are added yet.

12 Terms

1
New cards

Stack

Models and implements a stack data structure; follows Last In First Out (LIFO)

2
New cards

Stack()

Default constructor that is used to create an empty stack.

3
New cards

Serializable

a marker interface that classes must implement if they are to be serialized and deserialized

4
New cards

Cloneable

An interface in Java which needs to be implemented by a class to allow its objects to be cloned

5
New cards

Iterable

an interface represents a collection of objects which is iterable – meaning which can be iterated

6
New cards

Collection<E>

Represents a group of objects known as its elements; used to pass around collections of objects were maximum generality is desired

7
New cards

List<E>

Provides a way to store the ordered collection; a child interface of Collection

8
New cards

RandomAccess

Marker interface used by List implementations to indicate that they support fast (generally constant time) random access

9
New cards

How to create new Stack in Java?

Import the java.util.stack package and use the Stack() constructor.

10
New cards

What does the push() method do?

It places an element at the top of the stack.

11
New cards

What is the use of the peek() method?

To retrieve an element from the stack without removing it.

12
New cards

What does the pop() method do?

It removes and returns the element at the top of the stack.