CSC300: Induction: Is this function useful? [7/37] Previous pageContentsNext page

01
02
03
04
05
06
07
public static int f (int x, int y) {
  while (y > 0) {
    x++;
    y--;
  }
  return x;
}

A useful loop.

Why is it useful? What does it do? How do you know?

invariant-progress

I will walk through the first part of these notes (also available here)

Previous pageContentsNext page