3.1 stack and queue Flashcards

1
Q

Stack abstract data type

A

push(e) – Insert element e at the top of the stack
* pop() – Remove the top element from the stack; an
error occurs if the stack is empty
* top() – Return a reference to the top element on the
stack, without removing it; an error occurs if the
stack is empty
* size() – Return the number of elements in the stack
* empty() – Return true if the stack is empty and false
otherwise

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
1
Q

LIFO (last-in first-out)

A

stack

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Queues

A

FIFO (First in First out)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Queue Abstract data type

A

enqueue(e): Insert element e at the rear of the queue
* dequeue(): Remove element at the front of the
queue; an error occurs if the queue is empty
* front(): Return, but do not remove, a reference to the
front element in the queue; an error occurs if the
queue is empty
* size(): Return the number of elements in the queue
* empty(): Return true if the queue is empty and false
otherwise

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

STL queue

A

size(): Return the number of elements in the queue
* empty(): Return true if the queue is empty and false
otherwise
* push(e): Enqueue e at the rear of the queue
* pop(): Dequeue the element at the front of the
queue
* front(): Return a reference to the element of the
queue’s front
* back(): Return a reference to the element at the
queue’s rear

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly