problem 1: Assume that you are given the results of 5 games of rock-paper-scissors. The outcomes are given to you on separate pieces of paper; each piece says either 'A' if the first person won, or 'B' if his opponent won.
prepare an algorithm, in English, for finding out who won the best out of 5 games (person A or person B).
problem 2: What is wrong with the given algorithm for sorting a deck of cards (considering the fundamental properties of algorithms)?
a) Put the cards together into a pile.
b) For each card in the pile: Turn it face up.
c) Sort the cards.
problem 3: prepare a detailed explanation of a function which takes in an integer as an argument, then prints out the squares of all positive integers whose squares are less than the input. (The squares are 1, 4, 9, 16, ... If the input was 5, it would print 1, 4. If the input was 10, it would print 1, 4, 9.)
problem 4: prepare down a pseudocode algorithm to print the numbers from 1 to 10, and then from 10 to 1, by using exactly one loop.
problem 5: The function contains() takes a food as an argument and states you whether the pizza contains that food. Tomas is allergic to peanuts, tuna, and onions but strangely, eating peanuts and onions altogether is fine for him. prepare a condition which finds out whether the pizza is safe for him to eat.