Stacks and Queues

Ace your homework & exams now with Quizwiz!

the stack class provided by the Java Collections Framework...

cannot be used to instantiate a stack of int, or of any primitive type

the stack empty operation...

checks to see if there is at least one item on the stack

a stream of cars going through a toll booth is an example of a ...

queue

the stack peek operation...

returns the item at the top of the stack, but does not remove it

compilers of modern programming languages support method calls and returns with an internal...

stack

a queue invariant is a condition...

that is required to be true after the execution of each queue class method

in a list implementation of a queue, the end of the list from which elements are removed is called...

the front of the queue

an an implementation of a stack based on a singly-linked list, it is most efficient to add a new item so that...

the new item has the lowest index of all items in the list

in a list implementation of a queue, the end of the list at which elements are added is called...

the rear of the queue

in a list implementation of a stack, the end of the list at which elements are added and removed is called...

the top of the stack

in an array-based implementation of a stack, an operation that needs to add a new element to the stack may not be able to complete because the array is full. In this case, the failed operation should...

throw some appropriately defined exception

which of the following operations is not a stack operation?

A) remove and return an item with a specified value B) set the element at the bottom of the stack to a specified value C) remove and return the item at a specified position D) All of the above: that is, none of the above are stack operations Answer: D

the stack push operations....

adds a single item to the stack

the operation for removing an item from a queue is called

dequeue

the stack pull operation...

does not exist. There is no such stack operation

and operation for adding an item to a queue is called

enqueue

the stack pop operation...

extracts one element from the stack and returns it

a queue is a container that allows elements to be stored and removed....

in a first-in-first-out fashion

a stack is a container that allows elements to be stores and removed...

in a last-in-first-out fashion

in the queue implementation that uses an array of fixed size,...

it is necessary to use the array as a circular buffer


Related study sets

CH 22 Nursing Management of the Postpartum Woman at Risk; CH 23 Nursing Care of the Newborn With Special Needs; CH 24 Nursing Care of the Newborn at Risk PrepU (Developmental)

View Set

Campbell Biology; Chapter 5: Worksheet

View Set

142 Acute & Chronic Illness - PRACTICE QUESTIONS

View Set

Chapter 20: Trauma and Surgical Management

View Set

UNIT #2: Regulation of Investment Adviser Representative

View Set

Ch 20 Trauma and Surgical Management

View Set