From the course: Programming Foundations: Discrete Mathematics

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Solution: Advanced techniques

Solution: Advanced techniques

From the course: Programming Foundations: Discrete Mathematics

Start my 1-month free trial

Solution: Advanced techniques

- [Voiceover] How did you make out with the last challenge in the series? In this challenge, you had to use a tree with variable length in coding, to translate words into binary, and then take a binary encoded message and translate it back into plain text. There was also a challenge to calculate the probability of events, using set notation. And, finally, to encrypt and decrypt using a Caesar cipher. Alright, let's take a look at my answers. Here is the binary tree on the right. The question was, how do you decode this binary list of numbers? Remember, it's a pre-fixed notation. So you start, 0-0-1. So, if I come down, 0-0-1. 0-0-1-1, I get to an S. When you get to a letter, you want to stop and start over at the top. This time, I have four 1s. Then, I have two more 1s. So that's going to take me all the way down to the M. Then I have three 0s, which takes me to the A. Next, I have 1-1-1, 1-1, but this time, 0. That takes me down to the R. Then I have 1-1-1, 0-0, and a 1, which is T…

Contents