Question

Suppose an initially empty queue has executed in some order a total of 30 enqueue operations,...

Suppose an initially empty queue has executed in some order a total of 30 enqueue operations, 10 first operations, and 15 dequeue operations, 5 of which raised EmptyErrors that were caught and ignored. What is the current size of queue?

Homework Answers

Answer #1

The current size of the queue is 20

Explanation:

A queue is a linear data structure in which addition is done at the one end and deletion is one at another end.

Insertion can be performed at the rear end.

Deletion can be performed at the front end.

The size of the queue initially is = 0

The size of the queue after 30 enqueue operations is = 30

The size of the queue after 10 first operations is = 30

The first operation doesn't delete the element from the queue. So, the size of the queue will remain the same.

The size of the queue after 15 dequeue operations is = 30 - 15 = 15

But 5 of which raised EmptyErrors, so 5 dequeue operation failed.

The size of the queue after 5 dequeue operation failed = 15 + 5 = 20

Because the failed operation doesn't deleted any element from the queue.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Below are some cost data pertaining to Plant 1, which has total fixed costs of $1,000....
Below are some cost data pertaining to Plant 1, which has total fixed costs of $1,000. Suppose that Plant 2 is exactly twice the size of Plant 1 while using (at economic capacity) twice the amount of labour and materials, and that it produces exactly twice the output. Further, assume that the prices of these inputs do not change. Output $AC: Plant 1 10 200 20 175 30 150 40 175 50 200 60 250 70 350 Refer to the...
1)At 25°C, some second-order reaction 3 X (g)→ 2 Y (g) + Z (g) has a...
1)At 25°C, some second-order reaction 3 X (g)→ 2 Y (g) + Z (g) has a half-life of 5.82 hours when the initial concentration of X is 4.46 M. (a) What is rate constant for this reaction? (b) How much X will be left after 17.5 hours? Example of answer: (a) k = [type your answer] M–1 h–1; (b) [X]t = [type your answer] M. 2) For some second-order reaction: 3 X (g)→ Y (g) + Z (g). The following...
1- A mystery material is initially at 15°C. A total of 86 cal of heat is...
1- A mystery material is initially at 15°C. A total of 86 cal of heat is added to the material, changing its temperature to 61°C. If this material has a mass of 159 g, what must be the specific heat capacity of the material? (In cal/g·C°) 2- Is it possible for there to be a system where heat is added to a gas, but the gas maintains a constant temperature? 3- Two identical conducting spheres on insulating stands each initially...
Suppose two companies X and Z have exactly the same operating characteristics and their business risks...
Suppose two companies X and Z have exactly the same operating characteristics and their business risks are perfectly correlated (i.e., exactly the same cashflows). They differ only in the way they finance their operations. Both companies will be liquidated exactly one year from now and shareholders will receive a liquidating dividend at the end of the year. Company X is expected to pay a liquidating dividend of $55 million, but this is uncertain, so shareholders discount this dividend at a...
8. The reserve requirement, open market operations, and the money supply Assume that banks do not...
8. The reserve requirement, open market operations, and the money supply Assume that banks do not hold excess reserves and that households do not hold currency, so the only form of money is demand deposits. To simplify the analysis, suppose the banking system has total reserves of $300. Determine the money multiplier and the money supply for each reserve requirement listed in the following table. Reserve Requirement        Simple Money Multiplier                Money Supply ($$)       (Percent)           5   (0.5,...
SHOW ALL WORK, Please :) Marcus Simmons caught the flu and needed to see the doctor....
SHOW ALL WORK, Please :) Marcus Simmons caught the flu and needed to see the doctor. Simmons called to set up an appointment and was told to come in at 1:00 p.m. Simmons arrived at the doctor's office promptly at 1:00 p.m. The waiting room had five other people in it. Patients were admitted from the waiting room in FIFO (first-in, first-out) order at a rate of 5 minutes per patient. After waiting until his turn, a nurse finally invited...
  1.     In the first month of operations, the total of the debit entries to the cash...
  1.     In the first month of operations, the total of the debit entries to the cash account amounted to $1900 and the total of the credit entries to the cash account amounted to $800. The cash account has a balance of……………….     2.     Dawson’s Delivery Service purchased equipment for $3,500. Dawson paid $500 in cash and signed a note for the balance. Dawson debited the Equipment account, credited Cash and a.   debited the Dawson, Capital account for $2,000. b.   credited...
Question 1 (30 Marks) Company Marvel has been in the filmmaking industry for quite a while...
Question 1 Company Marvel has been in the filmmaking industry for quite a while and is specialized in making sci-fi and superhero movies. Due to recent advancement of digital technology and 5G internet, the company decides to set up a subsidiary company (Company Cyrus), which will specialize to focus on the development of filmmaking and internet related technology. This will further improve the company’s comparative advantage in filmmaking industry and capture the latest trend and taste in the younger generation...
Acorn Ltd. has a November 30-year end. As of December 01, 2015, Acorn Ltd. had the...
Acorn Ltd. has a November 30-year end. As of December 01, 2015, Acorn Ltd. had the following UCC balances for its various tangible assets:                                               Class 01             $705,600                                               Class 08             330,000                                               Class 10             185,000                                               Class 13             175,500 Class 01: A new building was purchased on December 15, 2015 at a cost of $ 950,000, with $ 150,000 of this total being allocated to the land on which the building was situated. The new building was used 50%...
Tybee Industries Inc. uses a job order cost system. The following data summarize the operations related...
Tybee Industries Inc. uses a job order cost system. The following data summarize the operations related to production for January, the first month of operations: a. Materials purchased on account, $29,800. b. Materials requisitioned and factory labor used: Job Materials Factory Labor 301 $ 2,960 $2,775 302 3,620 3,750 303 2,400 1,875 304 8,100 6,860 305 5,100 5,250 306 3,750 3,340 For general factory use 1,080 4,100 c. Factory overhead costs incurred on account, $5,500. d. Depreciation of machinery and...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT