Comprehensive Study Notes on Data Representation and Compression
Lesson 1: Fundamentals of Representation
Representation Basics
Representation relies on agreed-upon systems of symbols (e.g., alphabet, musical notes, mathematical symbols).
Computers store programs, text, numbers, images, and audio purely as numerical representations.
Data vs. Instructions
Data: Raw values or operands passed into the computer (e.g., numbers, text strings).
Instructions: Commands or operations executed on that data (e.g., add, multiply, save).
Binary & Electronic Circuits
Computers utilize electrical circuits made of microscopic electronic switches called transistors (approximately in size).
Each transistor exists in one of two physical states: ON (current flowing, represented by ) or OFF (no current, represented by ).
Any system with two distinct states is referred to as binary.
Increasing the number of binary switches increases the number of representable states: bits yield unique combinations.
Lesson 2: Number Bases and Conversions
Number Base Systems
Decimal (Base-10): Uses unique digits ( through ). Place values increase by powers of from right to left (, , , , etc.).
Binary (Base-2): Uses unique digits ( and ). Place values increase by powers of from right to left (, , , , , , , , etc.).
Base notation is expressed using subscript numbers (e.g., indicates binary, while indicates decimal).
Conversions Between Binary and Decimal
Binary to Decimal: Write down the 8-bit place value grid (), insert the binary digits, and sum all values that align with a .
Decimal to Binary: Compare the decimal value against the binary place values from left to right. If the place value is less than or equal to the remaining number, place a in that column and subtract the place value; otherwise, record a .
Lesson 3: Binary Addition
The Four Golden Rules of Binary Addition
( written down, carry to the left)
( written down, carry to the left)
Method for Adding Numbers
Align bits in vertical columns starting from the least significant bit (rightmost).
Apply addition rules column-by-column, adding carried bits into the subsequent higher place value.
Lesson 4: Binary Subtraction
The Four Golden Rules of Binary Subtraction
(requires borrowing from the next column to the left)
Borrowing Mechanics
A borrowed from the adjacent left column has a place value equivalent to two s in the current column ().
If the adjacent column contains a , traverse leftward until a is encountered, decompose each intermediary column, and carry through to the target bit.
Lesson 5: Binary Shifts, Overflow, and Underflow
Binary Shifts
Left Shift (Multiplication): Shifting bits left multiplies the value. Shifting left by space multiplies by ; shifting left by spaces multiplies by (); shifting left by spaces multiplies by . Vacated positions on the right are padded with .
Right Shift (Division): Shifting bits right divides the integer value by . In integer arithmetic, bits shifted past the units column are discarded (truncated).
Arithmetic Errors
Overflow: Occurs when the result of a calculation exceeds the maximum value that the allocated number of bits can store (e.g., adding to an 8-bit limit of generates a 9th bit that is lost, wrapping the output to ).
Underflow: Occurs when a value is too small to be represented in the allocated precision (such as fractional bits shifted off the right side during division of real numbers).
Lesson 6: Signed Binary Integers
Signed vs. Unsigned Integers
Unsigned Integers: Represent only positive values and zero.
Signed Integers: Represent positive and negative whole numbers using the Most Significant Bit (MSB) as the sign indicator ( for positive, for negative).
Sign and Magnitude
The MSB specifies the sign (, ), while the remaining bits designate the magnitude (absolute numerical size).
In an 8-bit system, bit is allocated for the sign and bits are left for magnitude ( to ).
Two’s Complement
The standard approach used by computer systems. The MSB carries a negative place value (e.g., an 8-bit grid has place values: ).
Converting a Negative Decimal to Two’s Complement:
Write the positive decimal number in binary.
Invert (flip) all the bits (, ).
Add to the inverted binary pattern.
Lesson 7: Hexadecimal Representation
Hexadecimal Properties (Base-16)
Comprises symbols: digits and letters (, , , , , ).
Used because it provides a human-readable shorthand for binary, drastically shortens bit strings, and minimizes transcription errors.
Applications include HTML/CSS colour codes (e.g.,
#B827EB), MAC addresses, and memory dump debugging screens.
Hexadecimal Conversions
Each hexadecimal digit represents exactly bits ( nibble).
Two hexadecimal digits equal bits ( byte).
Binary to Hex: Split the binary byte into two separate 4-bit nibbles, convert each nibble to decimal (), and write the corresponding hex symbol.
Lessons 8 & 9: Character Sets (ASCII & Unicode)
Character Sets Overview
A defined list of characters recognized by computer hardware and software, paired with unique binary codes.
Characters are arranged logically and sequentially (e.g., uppercase letters, lowercase letters, and digits form continuous numerical blocks).
ASCII (American Standard Code for Information Interchange)
Originally standard 7-bit ASCII ( unique characters).
Extended ASCII uses 8 bits ( byte per character, yielding combinations).
Limited to standard Latin letters, numbers, and basic punctuation; incapable of supporting non-English languages, emojis, or specialized symbols.
Unicode
Extends text encoding using variable lengths up to bits ( bytes per character), accommodating over potential patterns ( currently assigned).
Backwards-compatible with 7-bit ASCII (character codes through are identical).
Text File Size Formula
Lessons 10 & 11: Bitmap Images & Size Calculations
Bitmap Construction
Images constructed from a grid of individual picture elements called pixels.
Colour Depth (Bit Depth): The number of bits allocated per pixel. The formula for available colours is:
where represents the colour depth in bits (e.g., , , ).Resolution: Can be defined by pixel dimensions () or pixel density (pixels per inch / ).
Metadata
Defined as "data about data". Provides essential context required to render the raw bits accurately.
Examples: image dimensions, colour depth, creation date/time, GPS coordinates, camera settings, and file format.
Bitmap File Size Formula
To calculate size in bytes, divide the result by .
Lessons 12 & 13: Sound Representation & Calculations
Sound Digitisation
Natural sound is a continuous analogue pressure wave where amplitude dictates volume and frequency dictates pitch.
Computers convert analogue sound to digital through sampling (measuring wave amplitude at regular intervals and recording it as binary values).
Sample Rate: Number of audio samples recorded each second, measured in Hertz (). Standard professional audio uses ().
Sample Resolution: Number of bits allocated to represent the amplitude of each sample. Standard high-fidelity audio utilizes resolution ( amplitude levels).
Raising sample rate or resolution enhances playback fidelity while directly increasing file size.
Sound File Size Formula
Lesson 14: Data Storage Units and Prefixes
Hierarchy of Storage Units
Bit (): Single binary digit ( or )
Nibble:
Byte ():
Kilobyte ():
Megabyte ():
Gigabyte ():
Terabyte ():
Petabyte ():
Decimal vs. Binary Prefixes
Commercial manufacturers use base-10 decimal prefixes ().
Computing architectures rely on base-2 binary prefixes:
Kibibyte ():
Mebibyte ():
Gibibyte ():
Tebibyte ():
Lessons 15 & 16: Data Compression & Run-Length Encoding
**Lossy vs