Stacks and Queues Flashcards

1
Q

Stack

A

a data structure that mimics a list where items are added and removed from the top.

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

Pointer

A

will be used to store the address of the top of the stack

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

What 4 things are stacks used for?

A

Holding temporary instructions
For holding during an interrupt
Function/Subroutine Calls
Recursive algorithms hold previous results

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

Stack underflow

A

When there is nothing to pop out of the stack

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

Stack overflow

A

When you try pushing too much onto a stack that is already full

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

Queue

A

a data structure that mimics a list where items are added to the rear and removed from the front. It operates using a First In First Out (FIFO) Model

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

Start pointer

A

Stores the address of the front of the queue

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

Rear Pointer

A

Stores the address of the rear of the queue

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

Linked List

A

a dynamic data structure that store item in nodes

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

Node

A

Part of a linked list that has a pointer which points to the address of the next node

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

What do you do to add a new node at the end of a linked list?

A

Set the pointer of the last node to the new node.

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

What do you do to insert a new node between existing nodes?

A

Pointer of previous node is amended to point to new node, and the new nodes pointer points to the next node in list

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

What do you do to delete a node from a linked list?

A

Pointer of previous node before deleted item will change to point to the next item in the list

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

Traversing lists

A

Each node is visited and the pointer followed to the address of the next node

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

Single (linked list)

A

Nodes have a data item as well as a pointer to the next field, the last node contains a NULL pointer

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

Circular (linked list)

A

When the last node will point to the first node in the list

17
Q

Double/Doubly (linked list)

A

When each node will have a pointer to the next and previous nodes

18
Q

Name 2 advantages of linked lists over arrays

A

Much more efficient in terms of memory and processor usage

Inserting/Deleting only require pointers to be changed

19
Q

Name 3 disadvantages of linked lists over arrays

A

Cannot index a node, have to traverse
Requires storing of additional pointers
Nodes may not be stored contiguously