Simple data structures Flashcards

1
Q

Name 3 Simple Data Structures.

A

Arrays, Queues, Stacks

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

How does a stack work?

A

Adding: elements are pushed onto the top of the stack.
Retrieving: elements are popped from the top of the stack.
Elements are pushed and popped from the same end of the data structure.
LIFO

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

How does a queue work?

A

Adding: elements are enqueued from the tail
Retrieving: elements are dequeued from the head
Elements are enqueued and dequeued from opposite ends of the data structure.
FIFO

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

What methods are required for a Stack data structure?

A

Push: add an element to the stack
Pop: get the next element from the stack

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

What methods are required for a Queue data structure?

A

Enqueue: add an element to the queue
Dequeue: get the next element from the queue

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