Question: Due Date : March 1st , 11: 59 PM One difference between a queue and a stack is: A. Queues require linked lists, but stacks

Due Date : March 1st , 11: 59 PM

  1. One difference between a queue and a stack is:

A. Queues require linked lists, but stacks do not.

B. Stacks require linked lists, but queues do not.

C. Queues use two ends of the structure; stacks use only one.

D. Stacks use two ends of the structure, queues use only one.

  1. If the characters 'D', 'C', 'B', 'A' are placed in a queue (in that order), and then removed one at a time, in what order will they be removed?

A. ABCD

B. ABDC

C. DCAB

D. DCBA

  1. Which of the following expressions evaluates to true with approximate probability equal to P? (P is double and 0 <= P <= 1).

A. Math.random() < P

B. Math.random() > P

C. Math.random() < P * 100

D. Math.random() > P * 100

  1. In the linked list implementation of the queue class, where does the insert method place the new entry on the linked list?

A. At the head

B. At the tail

C. After all other entries that are greater than the new entry.

D. After all other entries that are smaller than the new entry.

  1. In the circular array version of the Queue class, which operations require linear time for their worst-case behavior?

A. getFront

B. insert when the capacity has not yet been reached.

C. isEmpty

D. None of these operations require linear time.

  1. In the linked-list version of the Queue class, which operations require linear time for their worst-case behavior?

A. getFront

B. insert

C. isEmpty

D. None of these operations require linear time.

  1. Describe why it is a bad idea to implement a linked list version a queue which uses the head of the list as the rear of the queue.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!