CS2400 M6 Flashcards
1
Q
Queue vs stack
A
FIFO (first in first out) vs LIFO (last in first out)
2
Q
myQueue.getFront();
A
Gets the first item in the queue without removing
3
Q
myQueue.dequeue();
A
Removes first item and returns it
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.
5
Q
How to add/remove to array queue
A
Add: at lastIndex + 1
Remove: firstIndex, then increase it
6
Q
Recursion
A
Problem solving process that breaks a problem into smaller problems of the same nature. Method calls itself.