#How exactly do you desk check/trace table a nested loop?

1 messages · Page 1 of 1 (latest)

cursive mist
#

this is just a sample

heavy fern
#

desk check/trace table

#

What this mean?

cursive mist
# heavy fern What this mean?

its like a table used to test algorithms in order to make sure that no logical errors occur while the calculations are being processed

heavy fern
#

Why have I never heard of that before

cursive mist
#

wow

#

do you know what an IPO chart is?

raven flax
#

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
cursive mist
#

other servers think im speaking greek or sum

raven flax
#

where o is whatever you wanna output

raven flax
#

ok maybe high school

#

but still

cursive mist
raven flax
#

its fine im talking abt them

raven flax
#

do you understand it?

cursive mist
#

like headers or sum

raven flax
#

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

cursive mist
cursive mist
raven flax
#

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

cursive mist
#

can i show u what i did?

raven flax
#

however if the nested loop had like 3 variables, theyd all occupy the same row

#

sure show me

cursive mist
#

idk what tf i did

raven flax
#

is it igcse?

#

because i need to check the format

#

i dont remember we check conditions in this form of table

cursive mist
#

thats how the lecturer taught us

raven flax
#

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)