Sitemap
Martin

Martin

Software engineer writing practical, picture-first guides on Shopify, Node.js, Postgres and React.

Member-only story

Big O Explained in Pictures: Why Your Nested Loop Is Slow

4 min readOct 12, 2026
Press enter or click to view image in full size

Big O time is the language and metric we use to describe the efficiency of algorithms in mathematical way. Understanding it thoroughly can really help you in designing and writing algorithm. Remember that all applications are combination of small functions/methods with algorithm in it. Being able to understand the efficiency of an algorithm can help you determine efficiency of an application (although there are many factors involved in real world application)

Good example is change detection in Angular/React DOM tree as it involved the searching of DOM tree update in milliseconds. Many techniques like String manipulation, Dynamic Programming, DFS/BFS are used to find out the updates and also being efficiency enough to loop through out the DOM tree

Time Complexity

Press enter or click to view image in full size
Figure 1: Five common growth rates. The steeper the line, the faster the work grows.

Big O doesn’t measure seconds. It measures how the number of steps grows when the input grows.

Think of a road trip. A fast car or a slow van changes the hours, but a trip twice as long is still twice the driving. Big O only cares about that “twice as long” part.

--

--

Martin
Martin

Written by Martin

Software engineer writing practical, picture-first guides on Shopify, Node.js, Postgres and React.