Beginner’s Big O for Swift Developers

Get those algorithms right

Steven Curtis
The Startup

--

Photo by Kolleen Gladden on Unsplash

Difficulty: Beginner* | Easy | Normal | Challenging

This article covers Big O notation from the theory to practical examples in the Swift language including constant, linear and polymorphic time examples (but don’t worry, the code is here too!)

*This is seen as a beginner topic (first year Computer Science degree fare) but is certainly not easy.

Prerequisites:

Terminology

Algorithm: A process or set of rules to be followed

Big O Notation: A mathematical notation to describe the limiting behaviour of a function when an argument tends towards infinity

Space complexity: The quantification of the amount of memory taken by an algorithm to run, as a function of its input

Time complexity: The quantification of the amount of time taken by an algorithm to run, as a function of its input

Multiple ways to do the same thing

--

--