Unit 2 Chapter 4 Stacks and Queues Terms & Concepts Flashcards
Stacks
allow access to only one data item: the last item inserted
Stack: FIFO or LIFO storage mechanism?
LIFO: Last In First Out
Stack: terms for adding and taking away items.
Push and pop.
Stack are Restricted, which means:
can’t access elements using an index.
The Peek function in a stack does what?
read the value from the top of the stack
Stack: Delimiter Matching function does what?
pairs of delimiters that are opened last should be closed first. Works using LIFO property of stack.
Queue: FIFO or LIFO storage mechanism?
FIFO: First In FIrst Out
Queue: terms for adding and taking away items.
insert and remove
Circular Queue function
front and rear “wrap around” to the beginning of the array.
Broken Sequence definition
the items in the queue are in two different sequences in the array.
Contiguous Sequence definition
items in the queue are in a single unbroken sequence in the array.
what is rear set to when insert( ) method wraps around from the top of the array to the bottom of the array in a circular queue?
rear is set to -1.
Deque definition
a double-ended queue, you can insert items at either end and delete them from either.
Priority Queue definition
items are ordered by key value so that the item with the lowest key (or highest key in some implementations) is always at the front. Items are inserted in proper position to maintain order. items with smaller keys are shifted up to make room.
Ascending-priority queue definition
the item with smallest key has the highest priority and is accessed with remove( ).