Lesson Note Taker

Fill in the blanks below during the binary presentation. You can visit our website here!^ Due to last minute deployment issues, may need to run a local server

  1. git clone https://github.com/TheoH32/Runtime_Terror.git
  2. run:
  • bundle install
  • bundle exec jekyll serve

Binary

  1. Binary is a base 2 number system.
  2. 0 represents off and 1 represents on.
  3. A bit is the minimum unit of binary information stored in a computer system.

Boolean Expressions

  1. A boolean expression is a logical statement that is either TRUE or FALSE and compares data.

Truth Tables

  1. The logical operations shown in truth tables are AND, OR, NOT, and XOR.
# AND
5 > 3 and 5 == 3 + 2
True
5 < 3 and 5 == 5
False
5 == 5 or 5 != 5
True
5 < 3 or 5 != 5
False

Real Life Example using Boolean Expressions

Try changing the conditions and/or the logical operation below! Run the code to see if you are eligible to vote.

age = 16
citizen = False

if age < 18 or not citizen:
    print("You are not eligible to vote.")
else:
    print("You are eligible to vote.")
You are not eligible to vote.

Binary Conversions

Binary to Decimal

  1. We can count in binary by using powers of 2.
  2. In binary, we read from right to left.
  3. 0111 has a value of 7.
  1. For a binary search, the list must be sorted.
  2. In a binary search, computers start at the middle.
  3. The number of steps required in a binary search follows the equation: log(n) + 1.
  4. Binary searches also work with a list of strings. We can sort them alphabetically.
  5. Binary searches can be represented in tree diagrams.

Hacks

You will NOT be awarded any points for sections that are INCOMPLETE

Note Taker

  1. Fill in all of the blanks above.

Lesson Quiz

  1. Complete the lesson quiz
  2. SCREENSHOT SCORE and paste it here (or paste screenshot with submission)

Binary Game

  1. Complete the Binary game and reach a minimum score of 10!
  2. SCREENSHOT SCORE and paste it here (or with submission)

Binary Conversions Practice

  1. Convert the decimal number "17" into binary. 0b10001
  2. Convert the binary number 1010 into decimal. 10
  3. Convert the decimal number "122" into hexadecimal. 0x7A
  4. Convert the hexadecimal number "09" into binary. 0b1001

Binary Search Questions

  1. Make a binary search tree of different the list [1,2,4,15,25,30,31]
           _________15_________
          /                    \
      ____2____              __25__
     /         \            /      \
    1           4         _30      31
                         /
                        25
  2. Put this list of strings in a order that can be used for binary search ["Donut”,"Cake”,"Soda”,"Banana”,"Fruit”] ["Banana", "Cake", "Donut", "Fruit", "Soda"]
  3. Explain why Binary Search is more efficient than Sequential Search. Binary search is more efficient than sequential search for sorted list because its time complexity is O(logn) vs O(n)

Extra Credit:

  • Translate the binary number, 1001010, into octal (base 8). SHOW YOUR WORK AND EXPLAIN YOUR THINKING.
1  0  0  1  0  1  0
64 32 16 8  4  2  1

64 + 8 + 2 = 74


74 - 64 = 10
10 - 8 = 2

1   1  2
64  8  1

Answer: 112

OR

  • write the best rap line (determined during the lesson by group)

Samarth the rapper's rhymes are hot, he spits fire like a dragon But when it comes to binary code, his knowledge is laggin' He knows his ABCs and his 123s, he's got a way with words But when it comes to ones and zeroes, he's like a flock of nerds

He's got the rhythm, he's got the flow, he's a master of his craft But when it comes to coding, he's like a car that's run out of gas He'll keep on rhyming, he'll keep on shining, he won't be deterred But when it comes to binary, he's like a deer in the headlights, blurred

He's got the rhymes, he's got the beats, he's got the style and flair But when it comes to binary code, he's like a fish out of water, gasping for air He'll keep on spitting, he'll keep on hitting, he'll keep on shining bright But when it comes to coding, he's like a blind man in a dark night

So Samarth the rapper, he's got bars for days, he's a lyrical mastermind But when it comes to binary, he's like a blindfolded man trying to find His way through a maze, he's like a bird that's lost its wings and can't fly But when it comes to rhyming, he's a genius, a star that shines up in the sky.

He's got the rhythm, he's got the flow, he's a master of his craft But when it comes to coding, he's like a car that's run out of gas He'll keep on spitting, he'll keep on hitting, he'll keep on shining bright But when it comes to coding, he's like a blind man in a dark night

He's got the rhythm, he's got the flow, he's a master of his craft But his coding skills are like a car that's lost its gas He'll keep on spitting, he'll keep on hitting, he's a star that shines so bright But when it comes to binary code, he's like a blind man struggling in the dark of night

Hacks Scoring

Hack Comments Grade
Note Taker fill in the blanks above 0.1
Lesson Quiz under 100% = 0.1 only 0.2
Binary Game must score at least 10 points 0.2
Binary Conversions Practice if incorrect= 0.2 awarded 0.2
Binary Search Questions if incorrect= 0.2 awarded 0.2
Extra Credit MUST SHOW WORK 0.1
Total expected= 0.9/1 1/1