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

  Writes the file content to another file

Write a method that takes as a parameter the name of a binary file, reads the content of the file and returns it as an array of bytes. Write a method that writes the file content to another file. Compare both files.

  Performance improvement models

Analyze one performance improvement model, such as plan-do-check-act, rapid cycle improvement, Six Sigma, or benchmarking. In your assignment, discuss the following:

  Determine what fraction of processor time is consumed

Consider a system employing interrupt-driven I/O for a particular device that transfers data at an average of 8 KB/s on a continuous basis.

  Object model for the library problem

Extend the following object model for the library problem to include a reservation object so patrons can reserve a book that has all copies checked out.

  How many code words have exactly three 0''s

How many code words have exactly three 0's?

  Show that the fundamental period nr of the signals

Show that the fundamental period Nr of the signals

  What are the inputs into the forensic analysis model

We indicated in the text that the best ways to manage security threats is to do an extensive risk assessment and more forensic analysis

  Variable types for pseudocode

THERE is NO need to declare variable types for your pseudocode. This will save you some time. Write a pseudocode (NOT a computer program) for a program that has a loop to continuously ask the user for a number,

  Practice in a logical way

How could the organization be roughly positioned in the future.

  Do the errors need reporting in some way

Is it acceptable in all cases for the method simply to do nothing if its parameter values are inappropriate? Do the errors need reporting in some way? If so, how would you do it, and would it be the same way for each error?

  Calculate fourier transform of function

Given a function f(x) as follows: f(0) = 2, f(1) = 3, f(2) = 5, f(3) = 4. Calculate the Fourier Transform of f(x), i.e: F(0), F(1), F(2) and F(3)!

  How many elements does the array contain

Declare and create the array as an integer array that has three rows and three columns. Assume that the constant ARRAY_SIZE has been declared to be 3.

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