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

  News article regarding denial of service attack

Research via the internet and find recent news article regarding denial of service attack, or distributed denial of service attack.Summarize the article using at least 500 words.The key to this assignment is to demonstrate your understanding of th..

  Describe modifications be made to poorly designed website

Discover the site which you feel is poorly designed and describe what modifications must be made using text as a guide.

  Bolstering network security by using group policy

Bolstering Network Security by Using Group Policy and Configuring GPO Security Settings

  The game tic-tac-toe

For your first assignment, download the linked file below. This is a .cpp file of the game Tic-Tac-Toe. Unzip the file, and run the game. Play a few games and begin to analyze the artificial intelligence that is currently programmed. Then, rev..

  Why were there so many dot-com

Why were there so many "dot-com" failures in the early part of 2000's?  What are the lessons learned from these experiences?

  Display the basic annual membership cost

In cell C5 insert a lookup function to display the basic annual membership cost of the first client.Insert a function in cell E5 to calculate total amount. The function should add the cost of membership plus, if applicable, the locker fee. The locker..

  Describe how you would apply slide transitions to your

instructions your responses should demonstrate your understanding of the course content and your analysis and critical

  The most frequent cause of it implementation failures

An evaluation of what you think is the most frequent cause of IT implementation failures. Justify your answer. Explain how change in management can help solve software implementation failures.

  Research and understanding of ide

Based on your research and understanding of IDE, post your response to the following question:

  Each office connects to via a wide area network (wan)

Application Architecture You have been tasked with building a payroll program for a large organization with offices spread across the United States. The company has one larger data center that each office connects to via a wide area network (WAN).

  Compare the types of computers

compare desktop and laptop, Introduce this two type of computer to the audience.

  Steps for company browse the site using this url

The static IP address of the server is 192.168.45.200. What steps do you take so that each computer in  company can browse site by using this URL?

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