CS2400 M6 Flashcards

1
Q

Queue vs stack

A

FIFO (first in first out) vs LIFO (last in first out)

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

myQueue.getFront();

A

Gets the first item in the queue without removing

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

myQueue.dequeue();

A

Removes first item and returns it

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

What do you do when the queue reaches the last array index?

A

backIndex = (backIndex+1) % queue.length;

Will circle to the front of the array again.

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

How to add/remove to array queue

A

Add: at lastIndex + 1
Remove: firstIndex, then increase it

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

Recursion

A

Problem solving process that breaks a problem into smaller problems of the same nature. Method calls itself.

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