Chapter One: Information Representation (00:00 - 10:00)
Computer can use Binary to represent numbers, text, images, sound, and apply
compression techniques to file formats.
o Binary system is used in computer science due to the computer's electrical
components that can only represent two states: on and off.
o Binary system is a base 2 system with two unique values.
Binary bits
o 8 binary bits represent one byte.
o 4 bits are called a nibble.
Hexadecimal
o Hexadecimal is a base 16 number system with unique values from 0 to 9 and
characters A to F.
o Used to simplify binary representation and can be written in one hexadecimal
character for every four binary bits.
o Used to define Arrow codes, IP addresses, MAC addresses, and HTML color
codes.
Binary to Decimal Conversion
o To find the decimal value of a binary, multiply the digit value by the place
value and sum everything up.
o To convert decimal to binary, keep dividing the decimal number by 2 and
obtain the remainder.
Binary to Hexadecimal Conversion
o Split the binary into chunks of four bits and refer to the hexadecimal table to
derive the hexadecimal value.
Conversion Examples
Binary to Decimal Conversion
o Multiply the place value by the digit value and sum everything up.
Binary to Hexadecimal Conversion
o Split the binary into chunks of four bits and refer to the hexadecimal table to
derive the hexadecimal value.
Converting Binary to Hexadecimal and Vice Versa (10:01 - 19:58)
Add two leading zeros to the remaining bits to convert binary to hexadecimal.
o Example: "you need to add two leading zero to the remaining bits here which
is what I do here zero zero one one."
To convert hexadecimal back to binary, refer to the table and use the denary value to
identify the hexadecimal number.
o Example: "if C is your hexadecimal value, you can just refer to this table...c
represents one one zero zero."
Converting Hexadecimal to Denary and Vice Versa
Similar to converting binary to denary, multiply the digit value by the place value.
o Convert characters to numbers before multiplying.
Converting denary to hexadecimal is similar to converting binary to binary.
o Divide the number by 16, obtain the quotient and remainder, and convert
numbers greater than 9 into their respective characters.
Binary and Decimal Prefixes
In computer science, binary prefixes are used, where 1 kilobyte (KB) is equal to 1024
bytes, instead of 1000 bytes in the decimal system.
o Reason: In computer science, when a new digit is added to binary, the value is
always multiplied by two.
Storage Terminology
4 bits = 1 nibble, 8 bits = 1 byte, and KB byte can be more complicated.
o For example, there are 1024 bytes in 1 kilobyte (KB).
Use the formula 1 megabyte (MB) = 1024 kilobytes (KB) to convert between
different forms.
Representing Negative Numbers
Computer scientists use the two's complement system to represent negative numbers
in binary.
o The leftmost bit acts as the sign bit, and the place value of the bit is made
negative.
Smallest and Largest Two's Complement Numbers
The smallest two's complement number is -8, and the largest is 7.
o To represent the smallest, set the leftmost bit as 1 and all other bits as 0.
o To represent the largest, set the leftmost bit as 0 and all other bits as 1.
Two different two's complement numbers may still sum to the same general value.
o Example: Both 1100 and 1101 sum up to the value -4.
Conclusion
Learnt how to represent positive and negative numbers in binary using the two's
complement system.
Binary Arithmetic (20:01 - 30:00)
Binary addition is similar to denary addition but with different rules for carrying over.
o In binary, 1 + 1 equals 10, with a carry to the next column.
o Summing two binary numbers involves adding each column and carrying over
as necessary.
Binary subtraction requires borrowing from the next column if necessary.
o For example, 110 - 10 involves borrowing to make the subtraction possible.
Overflow Problem
When adding binary numbers, an overflow problem can occur if the result exceeds the
storage capacity of the system.
o This is especially important for computers with fixed-size registers, as they
can only store a certain number of bits.
Overflow problems can also occur with two's complement numbers, leading to
unexpected results.
o This issue will be discussed further in chapter six.
Binary Coded Decimal (BCD)
BCD involves representing each digit directly in binary, without using division.
o There are two types of BCD: one BCD per byte and packed BCD, which uses
one nibble (four bits) per character.
BCD is commonly used in calculators and is important for handling floating point
numbers.
o It is crucial in detecting and correcting errors in BCD operations.
BCD Operation Example
Adding BCD numbers may result in an invalid binary representation, requiring special
BCD operations to correct.
o This involves adding chunks of bits and carrying over as needed to ensure a
valid BCD representation.
Conclusion
Understanding binary arithmetic, overflow problems, and BCD operations is essential
for working with binary data in computer systems.
These concepts are foundational for further chapters on computer architecture and
data representation.
ASCII System (30:02 - 40:02)
Each character is represented by a byte of binary codes
o Referring to the ASCII table gives the specific code for each character
ASCII codes represent English text elements like uppercase and lowercase letters,
punctuations, digits, and arithmetic symbols
o Codes for letters and numbers follow a sequential pattern
o Uppercase and lowercase characters only vary in the value of bit number six
Initially used seven bits but later abstracted to use eight bits (extended ASCII)
Limited number of codes for representing non-printing or control characters
Unicode System
Uses variable-length byte codes for character representation
o Some characters might use more bits than others
Different structures for character representation
o One byte code, two byte code, three byte code, four byte code
o Specific structure of the byte code allows the computer to identify the number
of bytes used to represent a character
Clever system for the computer to identify the structure being used
o Initial bits and byte sequence serve as a marker to indicate the number of bytes
used
Image Representation
Two ways to represent images: vector graphics and bitmaps
o Vector graphics are defined by mathematical equations, allowing for
scalability without loss of quality
Contains a list with commands for each object, making it easy to scale
without loss of quality
o Bitmaps are a bunch of pixels with binary codes representing color
Colored depth determines the number of bits used to represent one
color
More bits allow for a greater variety of colors to be represented
Image Concepts (40:04 - 50:03)
Image Resolution
o Higher resolution = better quality
Color Depth
o Number of bits for each primary color
o Higher depth allows for a unique color range
Calculating Image Size
Use image resolution multiplied by color depth to get bits
o Convert bits to bytes by dividing by 8
Bitmap vs. Vector Graphics
Bitmap for detailed images
Vector for precision and scalability
Bitmap for embedding in documents or web pages
Sound Representation
Elimination of inaudible frequencies
Conversion of analog data to digital
Encoding sound data into binary using amplitude and pitch
Sound File Size Calculation
Sampling resolution: number of bits used to store each sample
Sampling rate: how many samples taken per second
Higher resolution and sampling rate lead to larger file sizes
Compression Techniques
Lossless Compression
o Run Length Encoding: encodes repeated values to reduce storage
Lossy Compression
o More significant decrease in file size but irreversible loss of information
Lossless Compression Techniques (50:05 - 54:38)
Run-Length Encoding
o Represents repeated characters with a count, reducing file size
o Works well with repeated text, reduces number of bytes used
Huffman Encoding
o Analyzes text to identify common characters
o Assigns the most frequent character with the least number of bits
o Creates a Huffman coding table to represent characters with varying bit
lengths
Lossy Compression Techniques
Compressing Sound
o Capitalizes on infrequent changes in sample values
o Converts individual sampler amplitudes to amplitude differences to save space
Compressing Images
o Establishes a coding scheme with reduced color scheme
o Converts similar colors to the same color to reduce the amount of bits used
Conclusion
Lossless compression retains all data but reduces file size significantly
Lossy compression may result in some data loss, particularly with sound