Книга: A Common-Sense Guide to Data Structures and Algorithms in Python, Volume 1
Назад: Chapter 20: Techniques for Code Optimization
Дальше: Start Here: The Best-Imaginable Big O

Prerequisite: Determine Your Current Big O

Before we get into the optimization techniques, though, it’s important to stress that there’s something you need to do before you start optimizing your algorithm.

The prerequisite to optimization is determining the efficiency of your current code. After all, it’s impossible to make an algorithm faster if you don’t know how fast it is now.

By now, you have a thorough understanding of Big O notation and the various categories of Big O. Once you know what category of Big O your algorithm belongs to, you can begin optimizing.

Throughout the rest of this chapter, I’ll refer to this step of determining your current algorithm’s Big O as the “prereq.”

Назад: Chapter 20: Techniques for Code Optimization
Дальше: Start Here: The Best-Imaginable Big O