Algorithms and OOD (CSC 207 2014S) : EBoards
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Rubric] - [Calendar]
Current: [Assignment] [EBoard] [Lab] [Outline] [Reading]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines] [Partners] [Readings]
Reference: [Java 7 API] [Java Code Conventions] [GNU Code Conventions]
Related Courses: [CSC 152 2006S (Rebelsky)] [CSC 207 2013F (Rebelsky)] [CSC 207 2013S (Walker)] [CSC 207 2011S (Weinman)]
Misc: [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] [Issue Tracker (Course)] [Issue Tracker (Textbook)]
Overview
How do we arrive at the invariant for the "Dutch National Flag" problem?
There's no particular strategy for arriving at invariants. It's like much of algorithm design: You think about the problem for awhile. In the case of invariants, the idea is that once you've started to design an algorithm, you have a model for the state of the system. The invariant represents that state.
In this particular case, I expect that midway through the algorithm, I'll have a section of red values, a section of white values, a section of blue values, and a section of unknown values.
In part D, I'm not sure about "one of which only takes on values of x^2^k". I think it should be "x^(2k)", not "x^2^k".
x^2^k is x^(2^k) and not (x^2)^k. And that's what I've written. Exponetiation is right-associative. And I do intend that it be "x to the powers of two". But that may not be the best invariant for you; it's just how I find it useful to think about the problem.
xk+1 = x * xk, for even k >= 0. I think you mean "every", not even._
While it's try for every k, I do mean "for even k", because I only want this rule to apply to odd exponents.
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Rubric] - [Calendar]
Current: [Assignment] [EBoard] [Lab] [Outline] [Reading]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines] [Partners] [Readings]
Reference: [Java 7 API] [Java Code Conventions] [GNU Code Conventions]
Related Courses: [CSC 152 2006S (Rebelsky)] [CSC 207 2013F (Rebelsky)] [CSC 207 2013S (Walker)] [CSC 207 2011S (Weinman)]
Misc: [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] [Issue Tracker (Course)] [Issue Tracker (Textbook)]
Copyright (c) 2013-14 Samuel A. Rebelsky.

This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this
license, visit http://creativecommons.org/licenses/by/3.0/
or send a letter to Creative Commons, 543 Howard Street, 5th Floor,
San Francisco, California, 94105, USA.