10BIG O AND PROGRAM EFFICIENCY

image

In the first seven chapters of this book, we focused on writing programs that were correct: for any valid input, we wanted our program to produce the desired output. In addition to correct code, though, we generally want efficient code, code that runs quickly even in the face of huge amounts of input. You may have received the occasional time limit exceeded error when working through the first seven chapters, but our first formal foray into program efficiency wasn’t until Chapter 8, when we solved Email Addresses. We saw there that sometimes we need to make our programs more efficient so that they can finish within ...

Get Learn to Code by Solving Problems now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.