Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Data items are stored in computer memory using a binary representation. In particular, positive integers are commonly stored using the base-two representation described in Section 2.2. This means that the base-ten representation of an integer that appears in a program or in a data file must be converted to a base-two representation. One algorithm for carrying out this conversion uses repeated division by 2, with the successive remainders giving the binary digits in the base-two representation from right to left. For example, the base-two representation of 26 is 11010, as the following computation shows. What data type can be used to keep track of these remainders?

434_binary representation.png

Each of these problems involves a collection of related data items: a pile of cards in Problem 1, a set of railroad cars in Problem 2, a collection of function information in Problem 3, and a sequence of remainders in Problem 4. In Problem 1, the basic operations are adding a card to and removing a card from the top of the discard pile. In Problem 2, the basic operations are pushing a car onto the siding and removing the last car previously placed on the siding. In Problem 3, when a function terminates, a return is made to the last function that was interrupted. Function information must therefore be stored in such a way that the last information stored will be the first removed from storage. From the diagram in Problem 4, we note that the bits that comprise the base-two representation of 26 have been generated in reverse order, from right to left, and that the remainders must therefore be stored in some structure so they can later be displayed in the usual left-to-right order.

In each case we need a "last-discarded-first-removed," "last-pushed-onto-first removed," "last-stored-first-removed," "last-generated-first-displayed" container. To illustrate this behavior, we focus on Problem 4. To display the base-two representation of an integer like 26 in the usual left-to-right sequence, we must "stack up" the remainders generated during the repeated division by 2, as illustrated in the diagram

in Problem 4. When the division process terminates, we can retrieve the bits from this stack of remainders in the required "last-in-first-out" order.

Assuming that a stack data type is available, we could use an algorithm like the following to convert from base-ten to base-two and display the result:

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92597654

Have any Question?


Related Questions in Computer Engineering

Question suppose you are tasked with designing the security

Question : Suppose you are tasked with designing the security system for a new web browser that supports rendering web pages with embedded web page scripts. What checks would you need to implement to ensure that executin ...

Tetrafluoromethane cf4 is a greenhouse gas synthesized by a

Tetrafluoromethane (CF 4 ) is a greenhouse gas synthesized by a violently explosive reaction between methane and fluorine. In joules, what is the average kinetic energy of a molecule of CF 4  at 57.2°C and 0.0010 atm?

Question 1 where to be careful when using cloud services2

Question: 1. Where to be careful when using cloud services? 2. What are those cloud essential characteristics in "The U.S. NIST Definition of Cloud Computing"? The response must be typed, single spaced, must be in times ...

In defining demand and supply why do economists focus on

In defining demand and supply, why do economists focus on price while holding constant other factors that might have an impact on the behavior of buyers and sellers?

Scenario your algorithm will keep track of a customers

Scenario Your algorithm will keep track of a customer's purchases at the local fireworks stand. Customers will not know exactly how many items they will purchase, so using a For loop on this lab is not allowed. Let's kee ...

Stereotypes are useful toolsthey provide a shorthand way of

Stereotypes are useful tools. They provide a shorthand way of dealing with differences and allowing us to categorize how people think about things and interact with our world. Explain the positive effects of stereotypes ...

Question initial post respond to each prompt below1describe

Question: Initial Post: Respond to each prompt below. 1. Describe one hardware component that are essential to YOU as a consumer. Provide three options (brand, style, etc.) for the component. 2. Offer two new or interest ...

Suppose two packets arrive to two different input ports of

Suppose two packets arrive to two different input ports of a router at exactly the same time. Also suppose there are no other packets anywhere in the router. a. Suppose the two packets are to be forwarded to two differen ...

Question you recently joined a local cyber security hackers

Question: You recently joined a local cyber security "hackers" group that meets once a month to discuss recent cyber security related events, as well as tools and techniques. You have offered to present at the next meeti ...

Question social networks facebook twitter linkedin etc are

Question : Social Networks (Facebook, Twitter, LinkedIn, etc.) are widely used today. Describe how this technology can be used effectively in a business setting. Are there any drawbacks or limitations to using social net ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As