AALGORITHM RUNTIME

Image

Each competitive programming problem that we solve in this book specifies a time limit on how long our program will be allowed to run. If our program exceeds the time limit, then the judge terminates our program with a “Time-Limit Exceeded” error. A time limit is designed to prevent algorithmically naive solutions from passing the test cases. The problem author has some model solutions in mind and sets the time limit as an arbiter of whether we have demonstrated those solution ideas. As such, in addition to being correct, we need our programs to be fast.

The Case for Timing . . . and Something Else

Most books on algorithms do ...

Get Algorithmic Thinking, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.