CSC180H1 Lecture Notes - Lecture 7: Pseudocode
Document Summary
lesson plan: q&a. Please come with questions as per the existing course content. Don"t wait until the end of the class! Ask during the q&a period: how to solve: 1 +2 -3 -4 +5 +6 -7 -8 -9 +10 +11 +12 First --- you have to step back and look at what the process is doing. It is computing a sign-alternating sum, where the period of the sign is increasing by 1 every cycle. From this you can infer one method of solution (referring to our examples, not new knowledge or your own creativity): You need to have some method of representing the current sign and updating that based on some condition. You need to track the period, and update it based on some condition. So you get the pseudocode (i. e. , "code" but in an informal sense, meant for you as a human and not for the machine): accum = 0.