Practice 1 (Year 1 Sem 2)

Practice 1 is the first practice in semester 2 of year 1, and the first practice in the total of year 1. It is a practice for Chapter 2: Algorithms, and is considered to be not too tough.

Description
Enter a number presenting your final answer, for example, 10. no units, no extra words.

Prerequisites

 * Complete Lab 1: Introduction to CT

Unlocked after completion

 * Obsessive Compulsive Disorder (Score at least 60% for Practice 1 [Chapter 2])
 * The "Star" Problem Solver (Score at least 100% for Practice 1 [Chapter 2])
 * No Problemo (Score at least 100% for Practice 1 [Chapter 2])

Question
Question 1: Hi-Lo Game

The computer is going to randomly select an integer from 1 to 70. You have to guess the number by making guesses until you find the number that the computer chose. Everytime you make a guess, the computer will let you know if the guess is "Too High", "Too Low", or "Correct Guess".

In the worst case scenario, what is the least number of guesses you would need to make before you guess correctly?

Solution
The binary search algorithm is the best algorithm you can use in this case. Draw a table to see the least number of guesses.

Question
Question 2: Encoding

Messages consisting only of the letters ABCDE are to be transmitted. Before being sent, A is encoded to 00, B to 01, C to 100, D to 101 and E to 11.

For example, the message BBD would be encoded to 0101101.

The message encoded as 01100101100 is received. What is the original message?

Solution
Let's say we have the string as 01100101100. Now, the first digit is 0, so we look ahead 1 digit. It is 1, so we know the first letter is B.

Replace the first 2 digits with B. Now we have B100101100. When the first digit is 1, if the next digit is 1, it is E, otherwise, we have to look ahead another digit.

You can now proceed with the rest of the algorithm.

Question
Question 3: Training

The new equipment has arrived and only one staff member is trained to use it. It takes a trained user one day to train two untrained staff members.

On the first day the trained staff member trains two others. On the second day these three train six others, so that at the end of the second day there are nine trained staff. Training continues in this manner until all staff have been trained.

There are 200 staff in total (including the trained staff member). How many untrained staff were trained on the 5th day?

Solution
Try to spot a pattern in the numbers 1, 3, 9 and so on or manually work out the answer until the fifth day.

Note that there are only 200 staff members. Also, do note that the question is asking for the number of untrained staff which were trained on the fifth day, and not the total number of trained staff or untrained staff on the fifth day.