At 11:01 AM -0400 5/9/02, Geuns, Hans wrote: >Ack! 90% of programming is correcting typos -- why do I love my job?... But >even when the typo is corrected, there's still something fishy about this >code.
Note that we all get better at finding bugs. The rate of creation stays about the same, but the complexity of the bugs you can create and fix increases. Bugs that drove you nuts at the start of the semester will be dispatched with ease in a year or two. > > What is the complexity of the following code (how fast does it run)? >> >> for (int i=n; i > 0; i = i--) >> for (int j=1; j < 1; j = j*2) >> READ: for (int j=1; j < i; j = >j*2) > > print(j); I don't believe I was quite that devious to spot the difference between "i--" and "i = i--", though I agree that the second form is very odd. If you find a problem that you think is devious, confusing, or otherwise broken, write a short note on the test explaining your insight, and solve the problem to the best of your ability. (Please don't try reduce the problem to a triviality.) If there are multiple correct solutions, we will give credit for each. - jeff parker
