ALGORITHMS

Understanding Big O

How efficient is your algorithm?

Valentin Podkamennyi
The Startup
Published in
8 min readMay 3, 2020

--

Image credit: Wikimedia

It’s indispensable to have a clear understanding of basic algorithms before attending a programming interview. In order to understand algorithms, it’s also important to know to measure the efficiency of an algorithm. This is done with a concept, called the Big O. There exists a common question that pops up on an algorithm interview as to “How efficient is your algorithm?”. So, unless you can come up with this from scratch and measure it, rather than memorizing it for different problems, it may cause your interview to drift away from a successful one.

In this article, we’ll try to simplify the understanding of the concept of Big O which may help you prepare for a programming interview or understanding how you can use it. We will try to understand Big O from first principles rather than encouraging ourselves to memorize the Big O for different problems. I will use the Python programming language for all the examples in this article.

What is Big O for?

Big O is a concept critical to algorithms and the most mathematical we’ll get in this article. Two main reasons of understanding this concept are:

  1. If you get a problem that you haven’t seen before, although you have experience dealing with hundreds of…

--

--

Valentin Podkamennyi
The Startup

Experienced software engineer, co-founder of Datamart, ex-Googler, specializing in web analytics, software development and architecture design. vpodk.com