Skip to main content
  1. /classes/
  2. Classes, Fall 2026/
  3. CS 2010 Fall 2026: Course Site/

cs2010 Notes: 09-02 Data

·304 words·2 mins·

Check Inkfish
#

  • Attendance
  • Homework is Posted

Data on Computers
#

Last time:

  • The basic unit of data, what computers really store, is the bit: A single off/on, 0/1, false/true value.
  • We want to be able to store complex stuff, like a movie. How?
  • Those things are pretty far apart. Let’s build in both directions and meet in the middle.

Bits to Numbers
#

  • One bit allows for two distinct values.
  • We could represent whatever with those values: 0 and 1, A and B, 37 and 381.
  • But a useful thing to represent is non-negative integers from 0: If we have two, it’s 0 and 1.
  • If we have two bits, that’s four distinct values, integers from 0: 0, 1, 2, 3
    • Show the values in binary
  • Three bits?
    • Show the values in binary
  • Eight bits?
  • N bits?
  • Modern computers don’t usually deal with single bits. Instead they deal with bytes (or groups of 8 bits) and common integer sizes: 16, 32, and 64 bit groups.

Numbers to Colors
#

  • (Most) human eyes sees: Red, Green, Blue
  • If we use 8 bits each for “how red”, “how green”, and “how blue”, we can represent 16 million different colors.
  • Put 1920x1080 colored pixels together and you have a 1080p display. 3840x2160 and you’ve got a 4k display

How big is an uncompressed 4k movie?
#

  • 3 colors x (3840 x 2160) pixels x 24 frames per second x (60 x 60 x 2) seconds
  • plus the audio stream
  • Words: kilobytes, megabytes, …
  • Base 10 vs Base 2

Binary <-> Decimal Conversion
#

  • Place value notation (base-independent, show binary and trinary)
  • Little-endian: Repeatedly divide by two.
  • Big-endian: Subtract out largest power of two.

Other Common Bases
#

  • Octal
  • Hexadecimal
Nat Tuck
Author
Nat Tuck