CS110A Week 3 Day 2 lesson on 09/03/2026
Watch on YouTube →
Overview
Indika Walimuni reviews number-system conversion techniques, including repeated division for decimal-to-base conversion, positional powers for base-to-decimal conversion, and bit grouping for binary-to-hexadecimal conversion. The lesson connects these ideas to 24-bit HTML color codes, bit-pattern capacity, character encoding, and a pair exercise to write an algorithm that reverses a two-digit decimal number, while emphasizing consistent practice and steady weekly study.
Key takeaways
- Decimal-to-base conversion follows one reusable rule: repeatedly divide by the target base, record remainders, and read them in reverse order; decimal 511 becomes hexadecimal 1FF.
- Positional notation converts a base-b number to decimal by multiplying each digit by its corresponding power of b; octal 67 is 55 decimal and hexadecimal F9 is 249 decimal.
- Binary maps neatly to hexadecimal in four-bit groups and to octal in three-bit groups because 16 = 2⁴ and 8 = 2³.
- A six-digit HTML color code represents 24 bits and can encode 2²⁴, or 16,777,216, distinct bit patterns.
- An algorithm for reversing a two-digit number can be designed by separating the tens and ones digits and rebuilding the value with their place values; for example, 19 becomes 91.
- The lesson's address-width comparison needs one correction: IPv4 addresses are 32 bits, while IPv6 addresses are 128 bits, not 64 bits.
Chapters
- Indika Walimuni plans to finish Canvas Module 2, a short introduction to concepts behind the CPU.
- The course focuses on programming fundamentals rather than requiring expertise in CPU internals.
- Students who find the technical material difficult can still proceed, since this background is not required for later programming.
- Convert decimal 255 by repeatedly dividing by base 2 and recording each remainder.
- Continue until the quotient reaches zero, then read the remainders from bottom to top.
- The result is 11111111 in base 2, an 8-bit representation of 255.
- For decimal-to-binary conversion, divide by 2; for decimal-to-hexadecimal conversion, divide by 16.
- When a hexadecimal remainder is 10 through 15, write A through F; for example, 15 is F.
- The instructor works through decimal 511 to show the remainder sequence that produces hexadecimal 1FF.
- Assign powers of 2 to binary positions from right to left, beginning with 2⁰.
- Multiply each bit by its position value and add the results: 16 + 8 + 4 + 2 + 1.
- The most significant bit has the greatest positional value; the rightmost bit is the least significant.
- For octal 67, calculate 6 × 8¹ + 7 × 8⁰ to get decimal 55.
- For hexadecimal F9, treat F as 15 and calculate 15 × 16¹ + 9 × 16⁰.
- The hexadecimal calculation gives decimal 249, illustrating the same positional-value method across bases.
- Convert hexadecimal F9 to decimal 249 first, then convert 249 to binary by repeated division by 2.
- The two-step route avoids a more complicated direct conversion between bases.
- Hexadecimal F9 corresponds to binary 11111001.
- Each hexadecimal digit represents four binary bits because 16 possible digit values equal 2⁴.
- Group binary digits from right to left in sets of four, adding leading zeros when needed.
- For octal, group binary digits in sets of three because 8 equals 2³.
- The instructor demonstrates mapping four-bit groups to hexadecimal digits using a conversion table.
- For example, the four-bit patterns 0101 and 1010 map to hexadecimal 5 and A.
- When the leftmost group has fewer than four bits, pad it with zeros before using the table.
- A six-digit HTML hexadecimal color code contains six groups of four bits, or 24 bits total.
- Twenty-four binary bits allow 2²⁴, or 16,777,216, possible patterns.
- The instructor connects those patterns to the range of colors represented by web color codes.
- One bit has 2 possible states, two bits have 4 combinations, and three bits have 8.
- The general rule is n bits provide 2ⁿ unique combinations; four bits therefore provide 16.
- An all-zero 24-bit color is black, while an all-one 24-bit color is white.
- The lesson uses address width to illustrate how adding bits increases the number of unique identifiers.
- IPv4 uses 32-bit addresses, giving 2³² possible bit patterns before practical allocation considerations.
- The instructor describes IPv6 as 64-bit, but that detail is incorrect: IPv6 addresses are 128 bits.
- Indika Walimuni introduces a learning segment on how repeated practice can improve skill and efficiency.
- The analogy shifts from sports and music to programming, where cognition and hand-eye coordination also benefit from practice.
- The accompanying explanation distinguishes brain neural pathways from the mistaken idea that muscles themselves store memories.
- The practice segment recommends minimizing distractions, including putting a phone in airplane mode.
- Start slowly to build correct repetitions before increasing speed.
- Frequent practice sessions with allotted breaks are presented as a common approach among athletes and performers.
- For a four-credit course, the class guideline is about 12 total hours of work per week, including four hours in class.
- That leaves roughly eight hours outside class for module activities, which can be divided into about an hour per day.
- Indika Walimuni recommends completing the assigned material before class so students can participate in discussion rather than catch up during class.
- Students interested in software engineering can later practice interview problems on sites such as LeetCode and HackerRank.
- Indika Walimuni notes that students have used independent practice to pursue internships, including at Google, Uber, and Tesla.
- Course support includes three teaching assistants, an on-campus tutor squad, and online tutoring or office hours.
- Computers need a character-encoding standard to represent letters and symbols as numbers.
- ASCII provides 128 code positions and primarily covers English letters, digits, punctuation, and control characters.
- Unicode preserves ASCII as a subset while supporting a much broader range of writing systems and symbols.
- A Unicode code point identifies a character; the lesson demonstrates notation such as U+0068 for lowercase h.
- Unicode was established in 1991, and its repertoire includes scripts beyond English, as well as historic characters and emoji.
- Unicode is not simply a fixed 32-bit encoding per character: UTF-8 and UTF-16 use variable-length encodings, and the Unicode code space is much smaller than 2³².
- The class looks up uppercase R and the digit 3 in a seven-bit ASCII table.
- Seven bits provide 2⁷, or 128, possible patterns.
- Unicode tables express code points with a U+ prefix; ASCII characters retain the same values within Unicode.
- Students work in pairs on a Canvas Module 2 problem: describe in English an algorithm that reverses a two-digit decimal number.
- The task is not to write Python code or to reverse a binary number; the input is any two-digit positive decimal integer.
- Indika Walimuni corrects an assignment description that accidentally referred to binary.
- Use place-value decomposition, as with 123 = 100 + 20 + 3, to reason about extracting digits.
- For 19, the goal is to isolate 1 and 9, then construct 91 as 9 × 10 + 1.
- The algorithm should work for every two-digit input, not only the example 19, and should be written as numbered steps.
- Students are asked to try the reversal algorithm over the long weekend; the class will solve it together on Tuesday.
- Lecture recordings are posted to Canvas, and students can use earlier examples of decomposing numbers as support.
- Indika Walimuni gives office hours as Tuesday and Thursday from 11:00 to 12:30 and encourages students who are behind to seek help.
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, indika walimuni.