[General boards] [Winter 2023 courses] [Fall 2022 courses] [Summer 2022 courses] [Older or newer terms]

A2 Q1a

UPDATE: Nevermind, I realized the k for loop would not run in this case since k = 2 > n - 1, which is why we still need to consider the 2 vertical beams afterwards.

For the pseudocode provided, let’s say n = 2. So, we’re on the first iteration of the loop.

We fill in matrix entires for
(i) the leftmost vertical member
(ii) 2 interior vertical members (inside the k for loop)
(iii) then it states the 2 rightmost vertical members. Wouldn’t these 2 rightmost vertical members be the same as the 2 interior vertical members from (ii)?

So beams 7 and 11 would be the 2 interior members and also the 2 rightmost vertical members?

I guess you answered your own question, but I can add that
the code for the two rightmost vertical members could be included
in the loop for k, with appropriate adjustment, which may require the last pair of vertical members be treated specially.
You don’t have to take this choice, but if you do, it can still be correct
(with appropriate adjustment).

  [General boards] [Winter 2023 courses] [Fall 2022 courses] [Summer 2022 courses] [Older or newer terms]