O'Reilly logo
  • Kashyap Joshi thinks this is interesting:

When people see two linear operations, they sometimes think the result is quadratic, but that only applies if one operation is nested inside the other. If you invoke one operation after the other, the runtimes add. If they are both in O(n), the sum is also in O(n).

From

Cover of Think Data Structures

Note

Important point. nested linear operation