Computer memory using a binary representation

Assignment Help Basic Computer Science
Reference no: EM131788972

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:

Reference no: EM131788972

Questions Cloud

How should this function information be stored : Complicating the situation is the possibility that one of these functions might also call itself-a phenomenon known as recursion
Find the price for which a fresh gallon of milk sells : find the price for which a fresh gallon of milk sells. Assume a service level of 97.5% and that the store purchases milk for $2.44 per gallon.
Discuss the effects of the alternative actions : Prepare a tabular summary of the effects of the alternative actions on the components of stockholders' equity
Difference in distribution mechanism for goods and services : Explain the difference in the distribution mechanism for goods and services in the market and command systems. Discuss the implications of this difference.
Computer memory using a binary representation : Data items are stored in computer memory using a binary representation. In particular, positive integers are commonly stored using the base-two representation
Contents of the array referred : Give the value of my Top and the contents of the array referred to by my Array in the stack s after the code segment is executed, or indicate why an error occur
Explain effects of given factors on the economy price level : Explain the effects of each of the following factors on the economy's price level and real GDP. Illustrate your explanations with appropriate diagrams.
Discuss dividends on common stock : Whetzel Corporation reported net income of $150,000, declared dividends on common stock of $45,000, and had an ending balance in retained
Consider advantages and disadvantages of erp as described : Consider the advantages and disadvantages of ERP as described in the text.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Define carrier wave

Which modulation scheme transmits the difference (or "delta") between two contiguous sampled points in a signal?

  Describe your strategy in a brief memo

What should Paperback Press watch for to detect possible obsolescence in the future? Develop a checklist with specific examples that management could use.

  What is the worst case run time for a binary search

What is the worst case run time for a binary search?

  Design new admission - registration system

WestEast College hires you as a systems analyst to design its new admission/registration system - The college only accepts online applications.

  Explain why the files are not the same size

If three text files contained in Assignment 4 Files.zip each contain the same information; however, the file sizes are not the same. Explain why the files are not the same size.

  What can an isp do to limit the distribution of hate e-mail

What can an ISP do to limit the distribution of hate e-mail? Why would such actions not be considered a violation of the subscriber's First Amendment rights?

  Program based on series to display a juggler sequence

All user input for this program will be need to be positive, non-zero values. So you will write a user-defined function to read positive, non-zero input from the user. The userdefined function requirements are: o The prompt for user input will be ..

  The product demand so crucial for a firm

Why is knowing (or estimating) the product demand so crucial for a firm?  In your response, include an example of a business that has suffered from poorly estimating the demand of its products.  Evaluate how or why the business made such a mistake.

  Significantly better performance and scalability

Tutor, would you like to select a specific product to secure the network? Would you consider the widely adopted Cisco's PIX which offers the following function:

  What is this bond price

The market requires an interest rate of 8% on bonds of this risk. What is this bond's price?

  Estate agents and an office manager in the office.

A new real estate company that would like to set up a Windows network in their office. (There is currently nothing in place.) They currently have ten real estate agents and an office manager in the office.

  Calculate the total power delivered to 500 ohm load

An audio frequency signal 5 sin(2p*100 t) is used to amplitude modulate a carrier of 20 sin(2p*103 t). Calculate the total power delivered to 500 Ohm load?

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