#How exactly do you desk check/trace table a nested loop?
1 messages · Page 1 of 1 (latest)
its like a table used to test algorithms in order to make sure that no logical errors occur while the calculations are being processed
Why have I never heard of that before
just each variable is a column and each row is an iteration of whichever loop
yk what fuck it ill make one
i | j | o
0 | | o
0 | 0 | o
0 | 1 | o
0 | 2 | o
0 | 3 | o
0 | 4 | o
0 | 5 | o
0 | 6 | o
1 | | o
1 | 0 | o
1 | 1 | o
1 | 2 | o
1 | 3 | o
1 | 4 | o
1 | 5 | o
1 | 6 | o
2 | | o
2 | 0 | o
2 | 1 | o
2 | 2 | o
2 | 3 | o
2 | 4 | o
2 | 5 | o
2 | 6 | o
thank you finally sb understands
other servers think im speaking greek or sum
where o is whatever you wanna output
its literally middle school CS 😂
ok maybe high school
but still
im new so like ......
its fine im talking abt them
maybe sum simpler
do you understand it?
like headers or sum
so i is your i variable, and j your j variable
as for the right-most column it's just the output which i didnt fill out but you fill it with j because that's where it is produced
yk what, ill make it nvm
oh right lol and they have to audacity to just joke around and say do it excel or word
i understand the first part so far
so it would look something like this
i | j | output
---|---|-------
0 | | Week: 0
0 | 0 | Day: 0
0 | 1 | Day: 1
0 | 2 | Day: 2
0 | 3 | Day: 3
0 | 4 | Day: 4
0 | 5 | Day: 5
0 | 6 | Day: 6
1 | | Week: 1
1 | 0 | Day: 0
1 | 1 | Day: 1
1 | 2 | Day: 2
1 | 3 | Day: 3
1 | 4 | Day: 4
1 | 5 | Day: 5
1 | 6 | Day: 6
2 | | Week: 2
2 | 0 | Day: 0
2 | 1 | Day: 1
2 | 2 | Day: 2
2 | 3 | Day: 3
2 | 4 | Day: 4
2 | 5 | Day: 5
2 | 6 | Day: 6
whenever you change a variable in a different loop, you add a new row
can i show u what i did?
however if the nested loop had like 3 variables, theyd all occupy the same row
sure show me
is it igcse?
because i need to check the format
i dont remember we check conditions in this form of table
ok let me check ur format real quick
yes this looks good, but in some sources they make the condition a separate column
ill show how
line | input | i | j | i <= 3 | j <= 7 | output
The headers would be like this and under the condition is true or false depending on the iteration
also in your paper, you forgot to log the variables
(btw sorry my table i sent has a few incorrect rows)