What is Big O Notation? — Explained in Simple Terms

Computer-Science-Algorithm-Complexity

What is Big O notation and why is it useful in software development?

Essentially, Big O notation is a special symbol that lets us know how fast an algorithm is. However, Big O notation doesn’t tell us how long the algorithm will take in terms of seconds, instead it allows us to compare the number of operations the algorithm will make. It’s all about the growth of an algorithm.

logarithm-example
exponent-example
Since we always round, it’s 50.
logarithm-example
exponent-example
When we round, it’s 50 billion.

Here are the top 5 most common Big O run times that you’re likely to come across (sorted from fastest to slowest):

  • O(log n) known as log time, example: Binary Search
  • O(n) known as linear time, example: Simple Search
  • O(n * log n) known as linearithmic/quasilinear, example: Quicksort
  • O(n²) known as quadric time, example: Selection Sort
  • O(n!) known as factorial time, example: an extremely slow algorithm like the traveling salesperson
Computer-Program

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store