Lab 1 Written Activity: Problems 2 & 4 Updated

  • In Problem 2, the loop pseudocode in the algorithms was updated to use a consistent wording. Previously, some loops specified "from x to z" and some specified "from x up to z".  Remember from class that "from 0 to n-1" is equivalent to "from 0 up to n-1". Some algorithms use "up to" and "down to" to clarify whether the loop counter is incremented or decremented. If an algorithm just says "from x to z", then the direction (increment or decrement) is usually not ambiguous based on the loop counter's initialization point and termination point -- if the termination point is >= the initialization point, then you can assume you increment; if the termination point is < the initialization point, then you can assume you decrement.
  • In Problem 4, the product in the expression was updated from the original to instead be replaced by

See Piazza for more information.