Question

In: Computer Science

Question 110 pts What are the contents of the queue bankLine after the following statements execute?...

Question 110 pts

What are the contents of the queue bankLine after the following statements execute? The front of the queue in the answers is the left-most value

QueueInterface<String> bankLine = newLinkedQueue<>();
bankLine .enqueue(“John”);
bankLine .enqueue(“Matthew”);
String next = bankLine .dequeue();
bankLine .enqueue(“Drew”);
bankLine .enqueue(“Heather”);
bankLine .enqueue(“David”);
next = bankLine .dequeue();

John, Drew, Heather
Heather, John, Drew
Drew, Heather, David
David, Heather, Drew

Flag this Question

Question 210 pts

What are the contents of the deque waitingLine after the following statements execute? The front of the queue in the answers is the left-most value

DequeInterface<String> waitingLine = new LinkedDeque<>();
waitingLine.addToFront(“Jack”);
waitingLine.addToFront(“Rudy”);
waitingLine.addToBack(“Larry”);
waitingLine.addToBack(“Sam”);
String name = waitingLine.removeFront();

Larry, Sam, Jack
Rudy, Jack, Larry
Larry, Jack, Rudy
Jack, Larry, Sam

Flag this Question

Question 310 pts

How does a queue organize its items?

according to the order in which they were added
by priority
alphabetically
randomly

Flag this Question

Question 410 pts

The ADT priority queue organizes objects

according to the order in which they were added
by priority
alphabetically
none of the above

Flag this Question

Question 510 pts

What item is at the front of the list after these statements are executed?

DequeInterface<String> waitingLine = new LinkedDeque<>();
waitingLine.addToFront(“Jack”);
waitingLine.addToFront(“Rudy”);
waitingLine.addToBack(“Larry”);
waitingLine.addToBack(“Sam”);
String name = waitingLine.getFront();

Jack
Rudy
Larry
Sam

Flag this Question

Question 610 pts

If we use a chain of linked nodes with only a head reference to implement a queue, which statement is true?

You must traverse the entire chain to access the last node.
Accessing the last node is very inefficient.
Both a and b
None of the above

Flag this Question

Question 710 pts

In the linked chain implementation of a queue, the chain’s first node contains

the queue’s front entry
the queue’s back entry
both a and b
none of the above

Flag this Question

Question 810 pts

In a linked chain implementation of a queue, the performance of the enqueue operation is

O(1)
O(log n)
O(n)
O(n^2)

Flag this Question

Question 910 pts

In a linked chain implementation of a queue, the performance of the getFront operation is

O(1)
O(log n)
O(n)
O(n^2)

Flag this Question

Question 1010 pts

In a circular array-based implementation of a queue, what is the performance when the enqueue operation must resize the array?

O(n^2)
O(n)
O(log n)
O(1)

Solutions

Expert Solution

The answer to the question is given below.

The answer to the 1,2 and 3 Questions is given in the below image.





The answer to the 4, 5,6,7 and 8 Questions are given below in the image.





The answer to the 9 and 10 Questions are given below in the image.









If the answer helped please upvote it means a lot. For any query please comment.


Related Solutions

After the following statements execute, what are the contents of the deque? DequeInterface<String> myDeque = new...
After the following statements execute, what are the contents of the deque? DequeInterface<String> myDeque = new LinkedDeque<>(); myDeque.addToFront("Jim"); myDeque.addToFront("Jess"); myDeque.addToBack("Jill"); myDeque.addToBack("Jane"); String name = myDeque.removeFront(); myDeque.addToBack(name); myDeque.addToBack(myDeque.getFront()); myDeque.addToFront(myDeque.removeBack()); myDeque.addToFront(myDeque.getBack()); I need to get this as an output: Jim Jess Jim Jess Jim Jill Jess Jim Jill Jane Jim Jill Jane Jim Jill Jane Jess Jim Jill Jane Jess Jim Jim Jim Jill Jane Jess Jess Jim Jim Jane Jess Help me please
As the following statements execute, what is the content of the priority queue? Show the content...
As the following statements execute, what is the content of the priority queue? Show the content of the queue after each step: PriorityQueue<String> myPriorityQueue = new PriorityQueue<>(); myPriorityQueue.offer("Jim"); myPriorityQueue.offer ("Jess"); myPriorityQueue.offer ("Jill"); myPriorityQueue.offer ("Jane"); String name = myPriorityQueue.poll(); myPriorityQueue.offer (name); myPriorityQueue.offer (myPriorityQueue.peek()); myPriorityQueue.offer ("Jim"); myPriorityQueue.poll();
What are the contents of the array after the for-loop in the following code?
(IN C)What are the contents of the array after the for-loop in the following code?int array[ SIZE ][ SIZE ] = { { 4, 5, 6, 7, 8 },{ 1, 2, 3, 4, 5 },{ 3, 6, 7, 8, 9 },{ 2, 3, 4, 5, 6 },{ 5, 6, 7, 8, 9 } };int i;int *ptr = array[ 0 ];for( i = 0; i < SIZE * SIZE; i++ ) {if( i % SIZE < 2 ) {*( ptr +...
Question 110 pts Which One (1) of the following traits is not a trait which all...
Question 110 pts Which One (1) of the following traits is not a trait which all vertebrate animals possess or share? Group of answer choices Dorsal, Nerve Chord Four Pentadactyl (five-fingered) appendages or limbs (4 legs or 2 arms and 2 legs) Post-anal tail Notochord or internal support rod Gill Pouches Flag this Question Question 210 pts ___________ is the comparative study of the similarities and differences between similar structures of related organisms. Group of answer choices Molecular Biology Genetics...
Using Triggers (5 pts.) Execute the following SQL to create the customer_audit table in the premier...
Using Triggers (5 pts.) Execute the following SQL to create the customer_audit table in the premier schema. CREATE TABLE IF NOT EXISTS customer_audit ( customer_num CHAR(3) NOT NULL,   customer_name VARCHAR(35) NOT NULL, street VARCHAR(15), city VARCHAR(15), state CHAR(2), zip CHAR(5), credit_limit DECIMAL(8,2), date_changed DATETIME NOT NULL, changed_by VARCHAR(45) NOT NULL); Notice that the audit table does not have a primary key defined. Explain why this might be acceptable. Based on the current attributes in the customer_audit table, suggest a possible...
Question 112.56 pts Which of the following statements is false? Taxes paid by a husband on...
Question 112.56 pts Which of the following statements is false? Taxes paid by a husband on a home owned by his wife are not deductible by the husband on the husband's separate tax return. Special assessments paid to improve streets, sidewalks, and other like improvements are not deductible as real estate taxes even though they are assessed by a county or municipality for the public welfare. If a taxpayer's mortgage requires his real estate taxes to be "escrowed," or included...
Question 110 pts The relatively short-term changes in allele frequencies within a population is __________. Group...
Question 110 pts The relatively short-term changes in allele frequencies within a population is __________. Group of answer choices Adaptation Microevolution Fitness Natural Selection Flag this Question Question 210 pts This world has many, diverse forms inhabiting every nook and cranny on, above, and below the surface of this Earth. Group of answer choices True False Flag this Question Question 310 pts The _______ occurs when large numbers of a population die off leaving a small gene pool in the...
Question 12 pts Which of the following statements is true regarding the normal distribution? The mean...
Question 12 pts Which of the following statements is true regarding the normal distribution? The mean and the median are roughtly equal to one another The mean is always greater than the median The mean is always less than the median The mean is always 1 Flag this Question Question 22 pts A smaller standard deviation for the normal probability distribution results in flatter curve that is more spread out around the mean skinnnier, taller curve that is more tightly...
Question 541 pts Which of the following statements is true? Group of answer choices A)Games with...
Question 541 pts Which of the following statements is true? Group of answer choices A)Games with strictly dominant strategies do not guarantee that players achieve the highest available payoffs in Nash Equilibrium. B) The prisoners’ dilemma game has no strictly dominant strategy. C) If a two-player game has a strictly dominant strategy for one player, then it must have a strictly dominant strategy for the other player. D) If a strategy is weakly dominant, then it is also strictly dominant....
philosophy class Question 110 pts Spooner explicitly says that the Constitution has no authority. True False...
philosophy class Question 110 pts Spooner explicitly says that the Constitution has no authority. True False Flag this Question Question 210 pts Schultz cites the writings of the Framers in his article. He does this to support his interpretation of the Constitution and thus his conclusion. This means his citations to those writings are evidence in his argument. True False Flag this Question Question 310 pts A Textualist says that the meaning of a text is set by the intentions...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT