Skip to content

Exercises

These are meant to be done as you go. If you get stuck, check the hints (or jump to Solutions).

Exercise — Boundary cost thought experiment

Consider these two designs:

A) Python loop calling a C++ scalar function 10 million times
B) One C++ function that processes an array of 10 million numbers once

Think about:

  • which is usually faster and why
  • what the “boundary cost” is in each case