Propose a procedure for manipulating the two pointers

Assignment Help Basic Computer Science
Reference no: EM131209859

[M] Write an IA-32 program to solve Problem 2.24 in Chapter 2.

Problem 2.24

[D] Another useful data structure that is similar to the stack is called a queue. Data are stored in and retrieved from a queue on a first-in-first-out (FIFO) basis. Thus, if we assume that the queue grows in the direction of increasing addresses in the memory, which is a common practice, new data are added at the back (high-address end) and retrieved from the front (low-address end) of the queue. There are two important differences between how a stack and a queue are implemented. One end of the stack is fixed (the bottom), while the other end rises and falls as data are pushed and popped. A single pointer is needed to point to the top of the stack at any given time. On the other hand, both ends of a queue move to higher addresses as data are added at the back and removed from the front. So two pointers are needed to keep track of the two ends of the queue. A FIFO queue of bytes is to be implemented in the memory, occupying a fixed region of k bytes. The necessary pointers are an IN pointer and an OUT pointer. The IN pointer keeps track of the location where the next byte is to be appended to the back of the queue, and the OUT pointer keeps track of the location containing the next byte to be removed from the front of the queue.

(a) As data items are added to the queue, they are added at successively higher addresses until the end of the memory region is reached. What happens next, when a new item is to be added to the queue?

(b) Choose a suitable definition for the IN and OUT pointers, indicating what they point to in the data structure. Use a simple diagram to illustrate your answer.

(c) Show that if the state of the queue is described only by the two pointers, the situations when the queue is completely full and completely empty are indistinguishable.

(d) What condition would you add to solve the problem in part (c)?

(e) Propose a procedure for manipulating the two pointers IN and OUT to append and remove items from the queue.

Reference no: EM131209859

Questions Cloud

Provide examples of how research can assist policy-makers : Describe the relationship between research and policy development. Provide examples of how research can assist policy-makers to inform their policy decisions.
Online mainstream news sources : Articles must include either international trade or international finance issues, but the U.S. does not have to be a part of the focus of the article. You will need to collect news articles from online mainstream news sources.  You will submit a U..
Describe to mr. steele his trial options : Identify all major steps you will take to prepare a defense for Mr. Steele , including investigation of evidence and witnesses, should Mr. Steele be arrested for a felony such as armed robbery. Explain to Mr. Steele the pre-trial process and any m..
Does frere bros have any remedy : During the first year of the agreement, Joe entered into a contract to star in a film being made by Pretty Pictures. Does Frère Bros have any remedy?
Propose a procedure for manipulating the two pointers : As data items are added to the queue, they are added at successively higher addresses until the end of the memory region is reached. What happens next, when a new item is to be added to the queue?
Eating half of the steak : Suppose you are on a date at Mastro's Steakhouse and order the 16oz New York Strip. After eating half of the steak, you feel full. Your date tells you that you should finish the steak since you have to pay for it regardless and should eat it while..
Describe the law and how you would address the issue : Using a minimum of three scholarly sources, compare and contrast the pros and cons of required professional qualifications for all medical examiners, regardless of where they work. Should a person who conducts an autopsy be required to be medicall..
Write a program to solve a problem of stack : [M] Write an IA-32 program to solve Problem 2.22 in Chapter 2. Assume that the element to be pushed/popped is located in register EAX, and that register EBX serves as the stack pointer for the user stack.
What is risk all business organisations strive : What is risk All business organisations strive to achieve specific goals, within the process businesses all take risks to determine outcomes - Legal and regulatory risk In the production of hospitality businesses we experience legal and regulatory..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Data representation-numbers

Think about the examples we discussed in class - how numbers can be represented in 4 bits or 8 bits, etc. Expand this thinking to 16 bits. If you were given 16 bits to work with, as the basis for your representation scheme:

  Write function xsort takes list strings returns sorted list

Write the function Xsort wich takes in a list of strings and returns sorted list with all words beginning wih "X" first in the list. f.ex: xsort (['kex', 'xylofonn', 'epli', 'xenos', 'asni']) returns ['xenos', 'xylofonn', 'asni', 'epli', 'kex']

  Attributes and behaviors

Write a Class called Course containing the following attributes and behaviors

  Processor do when it receives an interrupt request

What does the processor do when it receives an interrupt request from an external device? Describe the sequence of events and the signals activated.

  Using strategies that guide readers

Using Strategies That Guide Readers Write a Comparison/Contrast Essay. Prompt: At the bottom of page 443, in the paragraph "Writing about Comparisons and Contrasts" read the writing prompt of thesecond bullet point: "In an email to a friend, you mig..

  E-commerce for a building supply company

Capstone Project about E-Commerce for a Building Supply Company. It will consist of web-based front-end allowing customers to place orders and the store owner to see relevant views of the pending orders, together with a backend database in whi..

  Described the difference between the two flip flops

Described the difference between the two flip flops shown below. Develop truth tables for both devices to illustrate your answer.

  Write a commented c++ program to re-format dates

Write a commented C++ program to re-format dates. Prompt the user to input a date in the form: Sunday, January 2, 2010. Display the date in each of the following formats: January 2 was a Sunday in 2010 Sun, Jan 2 '10 2010-01-02

  Work breakdown structure

Assignment contains two (2) deliverables: a summary document to be delivered in a word processor document format and a Work Breakdown Structure (WBS) to be delivered in a project file.

  Massively multiplayer online role-playing games

In a virtual world (VW) of massively multiplayer online role-playing games (MMORPGs), collaboration and communication are provided through the Internet between MMORPG-ready devices such as the Microsoft Xbox, and Sony PlayStation, and by using the..

  Does the additional hing improve the fit

Does the additional hing improve the fit?

  The death of rhythm and blues by nelson george

Write a summary of the chapter "New White Negros" in the book the Death of Rhythm and Blues by Nelson George.

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