Hacker News new | ask | show | jobs
by ShaneWilton 4116 days ago
Really, unless you're trying to find a tighter upper bound on something like matrix multiplication, it just comes down to practice.

Most of the things you're going to run into on a daily basis are going to follow the same pattern, and so you just get an intuitive sense of runtimes after a little while. At my first internship, whenever I wrote a new function, I would mentally take note of what the runtime complexity was, which served two purposes:

1) It got me into the habit of thinking about runtime complexities.

2) It forced me to think about why different operations have different runtimes, which made them easy to reason about in the vast majority of cases.

If you're having a hard time thinking about complexity analysis, the same process might work for you.