Skip to content

steps against size

day 7

Day 7 counts a job's steps and names how they grow. A loop of nn passes at cc steps a pass takes cncn steps, and loops that run one after the other add. A loop inside a loop multiplies: nn outer passes, each running mm inner steps, take nmnm. The part latest in the list 11, log⁡2 n\log_2\, n, nn, n log⁡2 nn \,\log_2\, n, n2n^2, n3n^3, 2n2^n ends up biggest. To name the growth, keep that part and drop the number in front of it, so 9n+2n29n + 2n^2 grows like n2n^2 and is called quadratic. Lesson 7.6 counts memory in words of 64 bits. Lesson 7.7 shows that a count that never drops lies, at any size, between its counts at the powers of 2 either side.

the lessons

  1. 7.1 one loop's step count
  2. 7.2 a loop inside a loop
  3. 7.3 the part that ends up biggest
  4. 7.4 the number in front
  5. 7.5 naming how a count grows
  6. 7.6 how much work one step takes
  7. 7.7 when the size is not a power of two

the checkpoint

Score 10 or more out of 12 to pass the course's last checkpoint. A miss shows the lesson to go back to.

question 1, from lesson 7.1

A counter starts at 75 and goes down 7 each pass. The loop runs while the counter is above 0. How many passes?

A number, like 13, 9.5 or 19/2.

question 2, from lesson 7.1

A counter starts at 900 and is halved, rounding down, while it is above 20. How many passes?

A number, like 13, 9.5 or 19/2.

question 3, from lesson 7.2

An outer loop of 12 passes runs an inner loop of 15 passes each time, at 2 steps an inner pass. How many steps in all?

A number, like 13, 9.5 or 19/2.

question 4, from lesson 7.2

An outer loop goes over shelves 1 to 7 of a rack, and on shelf kk an inner loop stacks 3k+23k + 2 tins. How many tins in all?

A number, like 13, 9.5 or 19/2.

question 5, from lesson 7.3

Which ends up biggest?

question 6, from lesson 7.3

What is the first power of 2 where n log⁡2 nn \,\log_2\, n is more than 8n8n? Give nn itself, as a number like 64.

A number, like 13, 9.5 or 19/2.

question 7, from lesson 7.4

A count is 3n2+12n3n^2 + 12n. At what nn above 0 is the 12n12n part one tenth of the count?

A number, like 13, 9.5 or 19/2.

question 8, from lesson 7.4

Which grows like nn?

question 9, from lesson 7.5

Each extra item doubles a job's steps: 1 item takes 3, 2 take 6, 3 take 12. What is the name of its growth?

question 10, from lesson 7.5

A job does 11 set-up steps. Then an outer loop of nn passes runs an inner loop of 4 passes, at 7 steps an inner pass. What is the name of its growth?

question 11, from lesson 7.6

A number has 300 bits. How many words of 64 bits does it take?

A number, like 13, 9.5 or 19/2.

question 12, from lesson 7.7

A job's steps never drop as nn grows, and 2k2^k items take 5×2k5 \times 2^k steps. What is the most steps 700 items can take?

A number, like 13, 9.5 or 19/2.