Algorithms and Big O Notation

The five principle values you find in programming

Image for post
Image for post
Graphic copied from https://www.bigocheatsheet.com

O(1)

O(n)

for t in 0...n {
print("n ",n)
}

O(n2)

for t1 in 0...n {
for t2 in 0...n {
print("t1 t2 ",t1,t2)
}
}

O(log n)

O(nlog n)

Coding for 35+ years, enjoying using and learning Swift/iOS development. Writer @ Better Programming, @The StartUp, @Mac O’Clock, Level Up Coding & More

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