Complete this array-based implementation of the adt queue

Assignment Help Basic Computer Science
Reference no: EM131399814

The array-based implementations of the ADT queue in this chapter used a circular array. One implementation counted the entries in the queue, while the other left one location in the array unused. We used these strategies to tell when the queue was empty and when it was full. A third strategy is possible. It does not count and does not have an unused location in the circular array. After initializing frontIndex to 0 and backIndex to -1, you do not use modulo arithmetic when you increment these fields. Instead, you use modulo arithmetic when you index the array, but without changing frontIndex and backIndex. Thus, if queue is the array, queue[frontIndex % queue.length] is the front entry, and the entry at the back of the queue is queue[backIndex % queue.length]. Now if backIndex is less than frontIndex, the queue is empty. The number of entries in the queue is backIndex - frontIndex + 1. You can compare this number with the size of the array to see whether the array is full.
Since frontIndex and backIndex can continue to grow, they might become too large to represent. To reduce the chance of this happening, set frontIndex to 0 and backIndex to -1 whenever the implementation detects an empty queue. Note that adding to a full queue invokes ensureCapacity, which sets frontIndex to 0 and backIndex to the index of the entry at the back of the queue. Complete this array-based implementation of the ADT queue.

Reference no: EM131399814

Questions Cloud

Summarize the current organizational training program : Given the changing employee demographics and rapid updates to technology, it is important for organizations to link training and development to the needs and preferences of its workforce. Training facilitates acquisition of new knowledge and skill..
Physical security policy section of information security : Develop the Physical Security Policy section of the Information Security Policy. Include the following:
Identify and discuss the different types of training modes : An ongoing investment in training and development is essential for improving the performance and participation of employees in organizational initiatives. Such an investment encourages accountability in both management and employees in continuous ..
What are population mean and variance and standard deviation : if the possible values for x are 1, 2, 3, 4, 5 with probabilities .2, .1, .1, .5, .1, respectively, what are the population mean, variance and standard deviation?
Complete this array-based implementation of the adt queue : Note that adding to a full queue invokes ensureCapacity, which sets frontIndex to 0 and backIndex to the index of the entry at the back of the queue. Complete this array-based implementation of the ADT queue.
Number of standards and frameworks : This process is called certification and Accreditation. There are a number of standards and frameworks that may be used, depending on the organizations.
Will standard deviation increase or decrease or stay same : In given problem, suppose the possible values for x are now 0, 2, 4 with the same probabilities as before. Will the standard deviation increase, decrease, or stay the same?
Why are corporations setting up their own universities : Why are corporations setting up their own universities? Explain in detail and indicate the advantages and disadvantages of this approach. What approach would you use to encourage managers to coach their employees?
What are certification and accreditation : What are certification and accreditation when applied to information systems security management? How important are they to an organization?

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