I've been trying to wrap my head around the following question for ages, its part of my revision for the upcoming end of year exam, however I fail to see how there is a link from the number to the letter, how will one cycle from 1 to a and iterate to get there? if that makes any sense! We were told that when estimating execution time of a loop, it is likely to be the number of times the loop executes, so therefor a list of length n would take approximately n units of time to execute, that makes sense, its just the cycle from 1-a, then 1-b? like, how many iterations will the loop run to get from 1 to a? it just confuses me! anyhow here it is as on the practice paper:
z := 0
for i from 1 to a
for j from 1 to b
for k from 1 to c
z := z + a*b*c
• How long does it take to compute the k-loop?
• How long does it take to compute the j-loop?
• How long does it take to compute the i-loop?
• How long does it take to compute the algorithm?
a
,b
andc
are variables representing numbers, not the literal values "a", "b" and "c". – Wandering Logic Apr 04 '15 at 21:22