Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Algorithms & Complexity
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Cheesecake Labs
April 05, 2018
Programming
45
0
Share
Algorithms & Complexity
Frank Kair
Cheesecake Labs
April 05, 2018
More Decks by Cheesecake Labs
See All by Cheesecake Labs
Cats' wellness & care
cheesecakelabs
0
70
How do we create the first impressions?
cheesecakelabs
0
75
Menstrual cup: suit and freedom
cheesecakelabs
0
93
Life is a cycle, better with a bicycle
cheesecakelabs
0
77
Interview Process: how to get the best of people
cheesecakelabs
1
120
My capsule wardrobe experience
cheesecakelabs
3
83
Stonewall Rebellion and its impact on LGBTQIA+ history
cheesecakelabs
1
63
Pregnancy, childbirth and breastfeeding: What do I have to do with it?
cheesecakelabs
0
65
MBTI - Psychological types described by Jung
cheesecakelabs
0
160
Other Decks in Programming
See All in Programming
TSKaigi2026-静的解析への投資がAI時代のコード品質を支える ── カスタムESLintルールの設計と運用
hayatokudou
5
880
PHPでバイナリをパースして理解するASN.1
muno92
PRO
0
470
Are We Really Coding 10× Faster with AI?
kohzas
0
210
Stage 3 Decorators でできること / できないこと / TSKaigi 2026
susisu
1
400
AI駆動開発で崩れていくコードベースを立て直す
kyoko_nr_nr
1
270
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
620
TSKaigi 2026 TypeScriptバックエンドのオブザーバビリティ戦略 — Datadog × NestJSの実践
taiseiyamamotoan
1
110
AlarmKitで明後日起きれるアラームアプリを作る
trickart
0
140
サプライチェーン攻撃対策「層を重ねて落ちない壁」を10日間で組み上げた話 #TechLeadConf2026
kashewnuts
1
320
20260514 - build with ai 2026 - build LINE Bot with Gemini CLI
line_developers_tw
PRO
0
460
いつか誰かが、と思っていた フロントエンド刷新5年間の実践知
kiichisugihara
1
290
Agentic UI beyond Chats Architecture Patterns & Open Standards @ngMunich 05/2026
manfredsteyer
PRO
0
130
Featured
See All Featured
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
290
Optimising Largest Contentful Paint
csswizardry
37
3.7k
How to Ace a Technical Interview
jacobian
281
24k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.2k
What does AI have to do with Human Rights?
axbom
PRO
1
2.1k
Making the Leap to Tech Lead
cromwellryan
135
9.8k
Code Reviewing Like a Champion
maltzj
528
40k
Accessibility Awareness
sabderemane
1
120
How Software Deployment tools have changed in the past 20 years
geshan
0
34k
Color Theory Basics | Prateek | Gurzu
gurzu
0
310
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
570
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
170
Transcript
Algorithms & Complexity Frank Kair
Last time...
Project Euler
polyglot-euler
polyglot-euler
polyglot-euler
Fibonacci example
Analysis of Algorithms Asymptotics / Complexity Theory
None
Applied Maths → Computer Science
Complexity Analysis We need a way to define the runtime
of an algorithm regardless of the machine it’s currently running on.
Linear Search
Binary Search
Big O Big O is a mathematical notation that describes
the limiting behaviour of a function when the argument tends towards a particular value or infinity.
The letter O is used because the growth rate of
a function is also referred to as the order of the function. [...] an upper bound on the growth rate of the function. Big O
Big O
Big O Length Iteration worst case 1 1 10 10
100 100 1000 1000 10000 10000 … ...
Big O
None
Big O
How do we profile these algorithms?
Just count the loops, then?
Merge Sort
Merge Sort
Merge Sort
Merge Sort O(n)
Merge Sort
Merge Sort O(n)
Merge Sort O(n) O(n)
Merge Sort O(n) O(n) ?
Merge Sort Recurrence relation T(n) = c if n ==
1 = 2T(n/2) + n
Merge Sort Recurrence relation T(n) = c if n ==
1 = 2T(n/2) + n T(n) = 2T(n/2) + n
Merge Sort Recurrence relation T(n) = c if n ==
1 = 2T(n/2) + n T(n) = 2T(n/2) + n = 2 [ 2T(n/4) + n/2 ] + n
Merge Sort Recurrence relation T(n) = c if n ==
1 = 2T(n/2) + n T(n) = 2T(n/2) + n = 2 [ 2T(n/4) + n/2 ] + n = 4T(n/4) + 2n = 4 [ 2T(n/8) n/4 ] + n = 8T(n/8) + 3n = 16T(n/16) + 4n = ... = (2^k)T(n/(2^k)) + kn
Recurrence relation T(n) = c if n == 1 =
2T(n/2) + n T(n) = (2^k)T(n/(2^k)) + kn T(1) = c Merge Sort
Recurrence relation T(n) = c if n == 1 =
2T(n/2) + n T(n) = (2^k)T(n/(2^k)) + kn T(1) = c n/(2^k) = 1 Merge Sort
Recurrence relation T(n) = c if n == 1 =
2T(n/2) + n T(n) = (2^k)T(n/(2^k)) + kn T(1) = c n/(2^k) = 1 2^k = n Merge Sort
Recurrence relation T(n) = c if n == 1 =
2T(n/2) + n T(n) = (2^k)T(n/(2^k)) + kn T(1) = c n/(2^k) = 1 2^k = n k = lg n Merge Sort
Recurrence relation T(n) = c if n == 1 =
2T(n/2) + n T(n) = (2^k)T(n/(2^k)) + kn k = lg n T(n) = Merge Sort
Recurrence relation T(n) = c if n == 1 =
2T(n/2) + n T(n) = (2^k)T(n/(2^k)) + kn k = lg n T(n) = (2^lg n)T(1) + n lg n Merge Sort
Merge Sort Recurrence relation T(n) = c if n ==
1 = 2T(n/2) + n T(n) = (2^k)T(n/(2^k)) + kn k = lg n T(n) = (2^lg n)T(1) + n lg n = cn + n lg n
Merge Sort Recurrence relation T(n) = c if n ==
1 = 2T(n/2) + n T(n) = (2^k)T(n/(2^k)) + kn k = lg n T(n) = (2^lg n)T(1) + n lg n = cn + n lg n O(n log n)
Does it matter?
Data Structures
Arrays vs Linked Lists
Binary Search Tree
B+ Trees
Back to Fibonacci… Why was it bad?
Fibonacci
Fibonacci
Fibonacci
Fibonacci
Fast Fibonacci
Paradigms / Techniques
Divide and Conquer Dynamic Programming Greedy Paradigms / Techniques
The Classics
Fast Fourier Transform Page Rank Dijkstra Miller-Rabin The Classics
Thank you!