Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

A queue is a data structure use to store items. The next item removed from a queue is always the item that has been in the queue the longest (i.e., was added first - think of a line of people waiting to buy something). In this question, you will use a list to implement a queue and write several functions to perform operations on the queue. For this question, you may not use classes and/or object-oriented programming in your solution. Your program will need the following components:

1. A variable representing the maximum size of the queue (how many items can be stored in the queue at one time). This value should have a default value of 10.

2. A list type variable, which is used to store all of the data in the queue.

3. An enqueue function, which takes a single input value. If there is room in the queue (i.e., the current size is less than the maximum size), the value will be added to the end of the queue and the function will return True. If there is no room in the queue, the function will return False.

4. A dequeue function, which has no inputs. If the queue has any items in it, this function will remove and return the first item (i.e., from the front of the queue). If the queue does not have any items in it, the function should return None. In this case, None is the specific Python value representing nothing, not the string value "None".

5. A peek function, which has no inputs. If the queue has any items in it, this function will return the value of the first item in the queue but leave that item in the queue (different from the dequeue function). If the queue does not have any items in it, the function should return None. In this case, None is the specific Python value representing nothing, not the string value "None".

6. An isempty function, which takes no inputs. This function should return True if the queue is empty (no items) and False otherwise.

7. A getlist function, which has no inputs. This function will return the list that stores the queue data. This function can be used to print the queue contents using print(getlist()).

8. A multienqueue function, which takes a single list type input argument. This function should add as many of the items from the input list to the queue (i.e., keep adding until the queue is full or all items have been added) and return the number of items that were added successfully.

9. A multidequeue function, which takes a single integer input value N. This function should attempt to dequeue up to N items from the queue and return a new list containing all items removed (note: this may be less than N if the queue has become empty).

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92524929
  • Price:- $45

Priced at Now at $45, Verified Solution

Have any Question?


Related Questions in Computer Engineering

How does consumers influence the market price of goods it

How does consumers influence the market price of goods it sells, and what does the term, "market power" means?

Margaret moore wants to invest in four-year bonds that are

Margaret Moore wants to invest in four-year bonds that are currently priced at $863.49. These bonds have a coupon rate of 5.1 percent and make semiannual coupon payments. What is the current market yield on this bond? (R ...

Question whether in a scholarly or practitioner setting

Question: Whether in a scholarly or practitioner setting, good research and data analysis should have the benefit of peer feedback. For this Discussion, you will post your response to the hypothesis test, along with the ...

Suppose that you need to create two-table database to

Suppose that you need to create two-table database to record information for a DVD rental kiosk. The following information needs to be recorded. For all movies: Movie number, title, category, rental rate, and whether or ...

What strategies might help redirect a disruptive student

What strategies might help redirect a disruptive student? What strategies might help an unmotivated student?

A medical researcher is interested in determining whether a

A medical researcher is interested in determining whether a new medication for lung cancer is effective in a group of patients with early-stage disease. Explain what a Type I and Type II error would be in this study. (Be ...

Question suppose that an application has m input variables

Question : Suppose that an application has M input variables and that each variable partitions the input space into N equivalence classes. The multidimensional partitioning approach will divide the input domain into how ...

In the sans examples of policy the database access policy

In the SANS examples of policy, the database access policy states Database user names and passwords may be stored in a file separate from the executing body of the program's code. This file must not be world readable or ...

Taskwrite a cc program to emulate a simple calculator that

Task Write a C/C++ program to emulate a simple calculator that can calculate and display the results of performing one of the following arithmetic operations between two integer numbers (+, -, *, /). The Calculator progr ...

Create a class named horse that contains data fields for

Create a class named Horse that contains data fields for the name, color, and birth year. Include get and set methods for these fields. Next, create a subclass named RaceHorse, which contains an additional field that hol ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As