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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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