Computer science
Download
1 / 12

computer science - PowerPoint PPT Presentation


  • 91 Views
  • Uploaded on

CSCI 1001. overview of. computer science. REPRESENTING DATA I. What do each of these mean:. VII. 7. How do computers represent data ?. Review: Deci mal. What does the digit sequence 563 mean? . 5×10 2 + 6×10 1 + 3×10 0. bit: a value that is either 0 or 1.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'computer science' - arden


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Computer science

CSCI 1001

overview of

computer science

REPRESENTING DATA I


Computer science

What do each of these mean:

VII

7

How do computers represent data?


Review deci mal
Review: Decimal

What does the digit sequence 563 mean?

5×102 + 6×101 + 3×100


Computer science

bit: a value that is either

0 or 1

string: a sequence of bits

byte: a string of 8 bits


Bi nary
Binary

A bit string can represent a number:

110 =

1×22 + 1×21 + 0×20

A byte has the place values:

What is the smallest possible byte?

the largest?


Computer science

  • Input: a positive integer N

  • Find the largest k so that 2k ≤ N

  • for each power_of_2 ∈ {2k,2k-1,…,1}:

    • if N ≥ power_of_2 then:

    • set N = N - power_of_2 and output 1

    • else:

    • output 0

  • 3. stop.

  • setp = 1 and k = 0

  • whilep ≤ N/2:

    • set p = p×2 and k=k+1

PRACTICE: 11011100, 93, 42


Hexadecimal
Hexadecimal

Base 16:

0,1,2,…,9,A,B,C,D,E,F

0x37

  • = 5510

0x1A

  • = 2610

0xC2

  • = 19410

How many bits for a hex digit?

4 (a nibble)


Computer science

Hex

Binary

Decimal

0x2C

10100011

217


Ascii
ascii

1 Letter = One byte

“MINNESOTA” ⇒ 0x4D494E4E45534F5441

Moby Dick = 1,255,836 bytes



Computer science

1

1

1

1011

0111

+

1

1

0

0

0


Http cs1001 us
http://cs1001.us/

Please read Chapter 4.2.2 for Wednesday’s lecture.