Binary Place Value Table

| Binary Digit | 2⁷ | 2⁶ | 2⁵ | 2⁴ | 2³ | 2² | 2¹ | 2⁰ | |————–|—-|—-|—-|—-|—-|—-|—-|—-| | Example: 1101| 1 | 1 | 0 | 1 | | | | | ➡ 1×8 + 1×4 + 0×2 + 1×1 = 13

🍿 Popcorn Hack #1: Fill out the rest of the table and calculate what value is in binary: (final value should be 25)

🍿 Popcorn Hack #2: Binary Blitz! Convert the following decimals into binary: 10, 15, 17 10/2 = 5 R0 ; 5/2 = 2 R1 ; 2/2 = 1 R0 ; 1/2 = 0 R1 ; 10 -> 1010 15/2 = 7 R1 ; 7/2 = 3 R1 ; 3/2 = 1 R1 ; 1/2 = 0 R1 ; 10 -> 1111 17/2 = 8 R1 ; 8/2 = 4 R0 ; 4/2 = 2 R0 ; 2/2 = 1 R0 ; 1/2 = 0 R1 17 -> 10001

🍿 Popcorn Hack #3: Half & Half! Given the sequence of numbers, how would you search for the number 18? [3, 6, 9, 12, 15, 18, 21, 24]

MCQ

image.png

🏠 HOMEWORK HACK:

🧠 PART A: Binary Breakdown
Convert the following decimal numbers into binary, and then explain the place values used:

42/2 = 21 R0 ; 21/2 = 10 R1 ; 10/2 = 5 R0 ; 5/2 = 2 R1 ; 2/2 = 1 R0 ; 1/2 = 0 R1 ; 42 -> 101010
19/2 = 9 R1 ; 9/2 = 4 R1 ; 4/2 = 2 R0 ; 2/2 = 1 R0 ; 1/2 = 0 R1 ; 19 -> 10011
100/2 = 50 R0 ; 50/2 = 25 R0 ; 25/2 = 12 R1 ; 12/2 = 6 R0 ; 6/2 = 3 R0 ; 3/2 = 1 R1 ; 1/2 = 0 R1 ; 100 -> 1100100

For each one:

  • Show the division-by-2 steps
  • Show the binary result
  • Break it down using the place value table

💡 PART B: Binary to Decimal Sprint
Convert these binary numbers into decimal:

101010 ; 2⁵ 2⁴ 2³ 2² 2¹ 2⁰ = 1×32 + 0×16 + 1×8 + 0×4 + 1×2 + 0×1 = 32 + 0 + 8 + 0 + 2 + 0 = 42
10011 ; 2⁴ 2³ 2² 2¹ 2⁰ = 1×16 + 0×8 + 0×4 + 1×2 + 1×1 = 16 + 0 + 0 + 2 + 1 = 19
110011 ; 2⁵ 2⁴ 2³ 2² 2¹ 2⁰ = 1×32 + 1×16 + 0×8 + 0×4 + 1×2 + 1×1 = 32 + 16 + 0 + 0 + 2 + 1 = 51

  • Explain the place values and your math for each!

🔎 PART C: Binary Search in Action
You’re given a sorted list:
[3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33]

Tasks:
Search for 18
Target: 18
Steps:

Middle index = (0+10)//2 = 5, value = 18
Result:
Steps: Checked index 5 → 18
Comparisons made: 1
Found? Yes

Search for 33
Target: 33
Steps:
Middle index = (0+10)//2 = 5, value = 18 → 33 > 18 → Search right
New range: 6 to 10 → Middle = (6+10)//2 = 8, value = 27 → 33 > 27 → Search right
New range: 9 to 10 → Middle = (9+10)//2 = 9, value = 30 → 33 > 30 → Search right
New range: 10 to 10 → Middle = 10, value = 33
Result:
Steps: 18 → 27 → 30 → 33
Comparisons made: 4
Found? Yes

Search for 5
Target: 5
Steps:
Middle = (0+10)//2 = 5 → value = 18 → 5 < 18 → Search left
New range: 0 to 4 → Middle = (0+4)//2 = 2, value = 9 → 5 < 9 → Search left
New range: 0 to 1 → Middle = (0+1)//2 = 0, value = 3 → 5 > 3 → Search right
New range: 1 to 1 → Middle = 1, value = 6 → 5 < 6 → Search left
New range: 1 to 0 → Invalid range, stop
Result:
Steps: 18 → 9 → 3 → 6
Comparisons made: 4
Found? No

🔠 PART D: Binary Search with Strings
You’re given a sorted list of words:
[“apple”, “banana”, “carrot”, “dragonfruit”, “fig”, “grape”, “kiwi”, “mango”, “orange”, “peach”, “watermelon”]

Tasks:
-Search for “mango”
Target: “mango”
Steps:
Range: 0–10 → Mid = 5 → “grape”
→ “mango” > “grape” → Search right
New range: 6–10 → Mid = 8 → “orange”
→ “mango” < “orange” → Search left
New range: 6–7 → Mid = 6 → “kiwi”
→ “mango” > “kiwi” → Search right
New range: 7–7 → Mid = 7 → “mango”
Result:
Comparisons: “grape” → “orange” → “kiwi” → “mango”
Total comparisons: 4
Found? Yes
Search for “carrot”
Target: “carrot”
Steps:
Range: 0–10 → Mid = 5 → “grape”
→ “carrot” < “grape” → Search left
New range: 0–4 → Mid = 2 → “carrot” Result:
Comparisons: “grape” → “carrot”
Total comparisons: 2
Found? Yes
Search for “lemon”
Target: “lemon” (not in list)
Steps:
Range: 0–10 → Mid = 5 → “grape”
→ “lemon” > “grape” → Search right
New range: 6–10 → Mid = 8 → “orange”
→ “lemon” < “orange” → Search left
New range: 6–7 → Mid = 6 → “kiwi”
→ “lemon” > “kiwi” → Search right
New range: 7–7 → Mid = 7 → “mango”
→ “lemon” < “mango” → Search left
New range: 7–6 → Invalid → Not found
Result:
Comparisons: “grape” → “orange” → “kiwi” → “mango”
Total comparisons: 4
Found? No

✅ Free response questions 2-3 sentences each:
📌 1. Why is binary search more efficient for large data than linear search?
Binary search is more efficient because it eliminates half of the search space with each step, resulting in a time complexity of O(log N). In contrast, linear search checks each element one by one, which takes O(N) time. This makes binary search much faster for large datasets.

📌 2. What happens if the list isn’t sorted and you try to use binary search?
If the list isn’t sorted, binary search won’t work correctly because it relies on the ability to compare and eliminate half of the data based on order. You might get the wrong result or not find the target at all, even if it’s in the list.

📌 3. Could you use binary search in a video game leaderboard or streaming service search bar? Why or why not?
Yes, binary search could be used if the leaderboard or list of results is sorted, such as by score or title. However, in many cases, search bars use more complex algorithms that support partial matches or filters, so binary search alone might not be flexible enough.