What Does This Mean?
  1. What might you say about this loop test? while(x != 10 || x < 20)
  2. What might you say about this loop?
    for(int i = 1; i != 10 && i != 20; ++i)
    What if we change the initial value to 15? How about 20?
  3. What does this function compute?
    int f(int a) { if(a == 0) return 0; else if(a % 2 == 1) return 1 + f(a-1); else return f(a/2); }
  4. Does the following recursion terminate? For what parameter value(s)?
    int g(int a) { if(a > 0) return g(a/2 - 3*a/2); else if(a < 0) return g(a+1); else return 0; }
  5. Does the following recursion terminate? For what parameter value(s)?
    int foo(int a) { if(a == 1024) return 1; else if(a % 2 == 0) return foo(a + 1); else return foo(a - 2); }