Arnold Rosenbloom
arnold@cs.toronto.edu
http://www.cs.toronto.edu/~arnold

Problem Solving

Why is this important

Math is all around us, REALLY!!

It is part of the way we see the world. It is part of being human.

I Understand

I Understand

I Understand

Common mistakes

Problems

  1. Problems from the Problem Solving Diagnostic
  2. How many digits to represent 999!? How many 0s are at the end of 999! (Num0s.java Num0s.pl)
  3. A locker room has lockers numbered 0,1,2,...,1023. All lockers are initially closed. The first person walks in and flips every locker The 2nd person flips every other locker (starting at 0) The 3rd person flips every third locker (starting at 0) . . . The 1023 person flips every 1023 locker (starting at 0) At the end, which lockers are open and which are closed?

    Level 3 solution, Level 4 solution (no explanation given). Note the flaw at 0 in both cases.

  4. I have a garden with red,green and blue flowers (all represented). I notice that if I were to choose 3 of them, I would have at least one red. I were to choose 3 of them, I would have at least one green. Prove that if I choose any 3 of them, then I would have at least one blue.
  5. Card swapping problem: 25 people in a circle, a deck of 50 cards with numbers 1,1,2,2,...,25,25 on them. Each person gets 2 randomly selected cards. At each step, each person looks at their two cards and passes a smallest card left.

    Prove that eventually some person will be holding two cards with the same number on them.

  6. Write function compress(s) which returns the run length encoding of alphabetic String s. Example: compress("")="", compress("a")="1a", compress("aaaa")="4a", compress("aaaabbca")="4a2b1c1a" Many solutions
  7. The Jumble Problem: Word X is a jumble of word Y if the letters in X can be rearranged to give Y. Example: backwards drawbacks. Given a dictionary as input, find the largest group of words all of which are jumbles of each other.
  8. 15 puzzle Exercises (look at the source for the pages below):
  9. 1-50,000 1-50,000 Problem: You are given a list containing 100,000 numbers. Each of 1,2,...,50,000 appears twice in this list. Someone replaces one of the numbers with 73 and jumbles the list. Your job is to write a program to determine which number was removed.
  10. 2-Colouring the plane: Given an arrangement of infinite lines in the plane, prove that the regions defined by these lines can be coloured using only two colours. Two regions that share a line segment can not have the same colour.
  11. How many different ways are there to two color the regions in the above problem?
  12. Write a Java program that randomly draws 100 lines on a JPanel and then two-colours the resulting region.
  13. Write a recursive function isJumble(x,y) which determines if word x and y are jumbles of eachother.
  14. Use recursion/function calls to print out (0,0) (1,0) (1,1) (2,0) (2,1) (2,2) ... (n,0) (n,1) (n,2) ... (n,n)
  15. Become an expert at minesweeper
  16. Understand and explain the proof that Sqrt(2) is irrational. Modify it so that it now proves that Sqrt(5) is irrational. Modify it in a similar way so that it proves that Sqrt(16) is irrational (oops!!!) whats wrong?
  17. You have three Jugs with capacities 8,5,3 respectively. The Jug with 8 units is initially full. How can you measure 4 units? Write a java program that allows a user to play this puzzle. Use the Model View Controller architecture and a GUI front end.
  18. Consider a checkerboard which has dimensions 22000 by 22000. Now remove 1 square. You want to tile the checkerboard with tiles that have the shape below. You must not cover the 'removed' square.
    Prove that, no matter which square you remove, you can always completely tile the resulting checkerboard.
    o
    oo