36/36
Part 8 of 8 · Follow-upsCheck yourself
Check yourself
6 questions
  1. 1.You push 1, 2 and 3 onto a stack, then pop twice. What comes out, and what does each operation cost on a Python list used with append and pop()?

  2. 2.One sample shows ["main", "load", "parse"] at time 30 and the next shows ["main", "save"] at time 40. What events come at time 40, in order?

  3. 3.Two samples in a row show ["main", "a", "b"] and then ["main", "b"]. What happened between them?

  4. 4.f calls itself: the outer call runs from 0 to 40 and the inner one from 10 to 30, and nothing else runs inside them. What is f's total time, callees included?

  5. 5.The monotonic stack's next-larger loop has a while inside a for. Why is it O(n) and not O(n²)?

  6. 6.A loop calls a 2 ms function a thousand times, and a sampler takes a sample every 10 ms. Which result can you trust?

Now the problem this lesson builds to: 33 From stack samples to a tracePractice it