Lists, Stacks, and Queues Flashcards

1
Q

What is one of the most common data structures?

A

Lists

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

What is another word for lists?

A

Collections

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

What is one example of a linear list?

A

Arrays

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

Which data structure uses Last in, First out?

A

Stack

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

When is a stack in an overflow state?

A

When there is no more space and you attempt to push another value on it

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

What is the operation called when adding an element to a stack?

A

Push

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

What are the 4 stack operations?

A
  1. Push()
  2. Pop()
  3. Peek()
  4. isFull()
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is an example of a stack in the real world?

A

Undo operations

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

What are the elements in a linked list called?

A

Nodes

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

What do the nodes in a stack contain?

A

A pointer to “next” and some data

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

What is it called when you move from one node to another using the “next” pointer?

A

Link Hopping or Pointer Hopping

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

What is the first node in a linked list called?

A

Head

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

What is the last node in a linked list called?

A

Tail

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

Do stacks have a pointer to previous?

A

No

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

What does the tail of a singly linked list point to?

A

Nothing (nullptr)

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

What way is a singly linked list traversed?

A

From head to tail

17
Q

What is the difference between a singly linked list and a doubly linked list?

A

Pointer called “previous”

18
Q

How does a queue grow?

A

Add to it’s tail

19
Q

How does a queue shrink?

A

Remove from it’s head

20
Q

Which data structure is First in, First out?

A

Queue

21
Q

What operation adds an element to a queue?

A

Enqueue

22
Q

What operation removes an element from a queue?

A

Dequeue

23
Q

How many pointers does a circular queue require?

A

3

24
Q

What is the best data structure for a queue?

A

Doubly linked list

25
Q

What is a priority queue?

A

Adding a rule to prioritize something other than FIFO

26
Q

Which way of adding elements to a priority queue leads to slower removal?

A

Added in the order they come in

27
Q

Which way of adding elements leads to slower additions?

A

Adding based on priority