Variable representing the maximum size of the queue

Assignment Help Basic Computer Science
Reference no: EM131716237

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).

Reference no: EM131716237

Questions Cloud

Discuss taylors behaviors question her moral characteristic : The Bean Trees by Barbara Kingsolver how does Taylor's behaviors question her moral characteristic
Determine the probability for a randomly chosen day : Suppose the daily amount of solar radiation in Los Angeles is normally distribution with mean 450 calories and standard deviation 50.
How dothe federal policies affect her trial and disposition : How dothe federal policies affect her trial, and disposition? Are they an advantage or disadvantage? How do state policies affect her trial and disposition?
Discuss how are attitudes formed : Using some of these terms: social learning, unconditioned stimulus/conditioned stimulus, subliminal
Variable representing the maximum size of the queue : 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.
Explain the population variance in a distribution : If the cholesterol levels of adults are normally distributed with mean 230 and standard deviation 25, what is the probability that a randomly sampled adult.
Recall a moment when you acted as a utilitarian : Recall a moment when you acted as a utilitarian. Explain by calculating the net benefit you brought with your act. apply minimum (3 utilitarian claims) in your
What negative consequences can come from this kind of social : What benefits come from our children blindly following the authority figures in their life
Identify the audience or population that you seek : One of the pivotal goals of consumer health literacy efforts is to design educational materials that attract as well as educate users. In this Assignment

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd