Studying for a tech interview sucks. Here's an open source cheat sheet to help
TypeScript
4,688
50 commits
updated Jul 1, 2024
This list is meant to be both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth.
This is an open source, community project, and I am grateful for all the help I can get. If you find a mistake make a PR and please have a source so I can confirm the correction. If you have any suggestions feel free to open an issue.
This project now has actual code challenges! This challenges are meant to cover the topics you'll read below. Maybe you'll see them in an interview and maybe you won't. Either way you'll probably learn something new. Click here for more
Asymptotic Notation is the hardware independent notation used to tell the time and space complexity of an algorithm. Meaning it's a standardized way of measuring how much memory an algorithm uses or how long it runs for given an input.
The following are the Asymptotic rates of growth from best to worst:
O(1) Runtime is constant and does not grow with nO(log n) Runtime grows logarithmically in proportion to nO(n) Runtime grows directly in proportion to nO(n log n) Runtime grows in proportion and logarithmically to nO(n^c) Runtime grows quicker than previous all based on nO(c^n) Runtime grows even faster than polynomial growth based on nO(n!) Runtime grows the fastest and becomes quickly unusable for even
small values of n(source: Soumyadeep Debnath, Analysis of Algorithms | Big-O analysis)
Visualized below; the x-axis representing input size and the y-axis representing complexity:
![]()
(source: Wikipedia, Computational Complexity of Mathematical Operations)
Big-O refers to the upper bound of time or space complexity of an algorithm, meaning it worst case runtime scenario. An easy way to think of it is that runtime could be better than Big-O but it will never be worse.
Big-Omega refers to the lower bound of time or space complexity of an algorithm, meaning it is the best runtime scenario. Or runtime could worse than Big-Omega, but it will never be better.
Big-Theta refers to the tight bound of time or space complexity of an algorithm. Another way to think of it is the intersection of Big-O and Big-Omega, or more simply runtime is guaranteed to be a given complexity, such as n log n.
O(1), Dynamic array: O(1)O(n), Dynamic array: O(n)O(log n), Dynamic array: O(log n)O(n)O(n)O(n)O(n)O(1)O(1)O(n)O(1)O(1)O(1)For a full binary-tree reference see Here
O(log n)O(log n)O(log n)Recursion | Iteration
----------------------------------|----------------------------------
recursive method (array, n) | iterative method (array)
if array[n] is not nil | for n from 0 to size of array
print array[n] | print(array[n])
recursive method(array, n+1) |
else |
exit loop |
greedy algorithm (array)
var largest difference = 0
var new difference = find next difference (array[n], array[n+1])
largest difference = new difference if new difference is > largest difference
repeat above two steps until all differences have been found
return largest difference
This algorithm never needed to compare all the differences to one another, saving it an entire iteration.
O(n^2)O(n^2)O(n^2)O(1)
(source: Wikipedia, Selection Sort)
O(n^2) time complexity, in practice it is slightly less since its comparison scheme only requires checking place if it is smaller than its neighbor.O(n)O(n^2)O(n^2)O(n)
(source: Wikipedia, Insertion Sort)
O(n log n)O(n log n)O(n)O(1)![]()
(source: Wikipedia, Merge Sort)
O(n^2)O(n log n)O(n log n)O(log n)
(source: Wikipedia, Quicksort)
Khan Academy's Algorithm Course Graph Data Structure & Algorithms Data Structure Interview Questions Data Structure MCQ With Answers 10 Best Data Structures and Algorithms Books
83 followers · starred Mar 2025
4,827 followers · starred Apr 2021
674 followers · starred Mar 2026
88 followers · starred Oct 2019
Studying for a tech interview sucks. Here's an open source cheat sheet to help
TypeScript
4,688
50 commits
updated Jul 1, 2024
This list is meant to be both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth.
This is an open source, community project, and I am grateful for all the help I can get. If you find a mistake make a PR and please have a source so I can confirm the correction. If you have any suggestions feel free to open an issue.
This project now has actual code challenges! This challenges are meant to cover the topics you'll read below. Maybe you'll see them in an interview and maybe you won't. Either way you'll probably learn something new. Click here for more
Asymptotic Notation is the hardware independent notation used to tell the time and space complexity of an algorithm. Meaning it's a standardized way of measuring how much memory an algorithm uses or how long it runs for given an input.
The following are the Asymptotic rates of growth from best to worst:
O(1) Runtime is constant and does not grow with nO(log n) Runtime grows logarithmically in proportion to nO(n) Runtime grows directly in proportion to nO(n log n) Runtime grows in proportion and logarithmically to nO(n^c) Runtime grows quicker than previous all based on nO(c^n) Runtime grows even faster than polynomial growth based on nO(n!) Runtime grows the fastest and becomes quickly unusable for even
small values of n(source: Soumyadeep Debnath, Analysis of Algorithms | Big-O analysis)
Visualized below; the x-axis representing input size and the y-axis representing complexity:
![]()
(source: Wikipedia, Computational Complexity of Mathematical Operations)
Big-O refers to the upper bound of time or space complexity of an algorithm, meaning it worst case runtime scenario. An easy way to think of it is that runtime could be better than Big-O but it will never be worse.
Big-Omega refers to the lower bound of time or space complexity of an algorithm, meaning it is the best runtime scenario. Or runtime could worse than Big-Omega, but it will never be better.
Big-Theta refers to the tight bound of time or space complexity of an algorithm. Another way to think of it is the intersection of Big-O and Big-Omega, or more simply runtime is guaranteed to be a given complexity, such as n log n.
O(1), Dynamic array: O(1)O(n), Dynamic array: O(n)O(log n), Dynamic array: O(log n)O(n)O(n)O(n)O(n)O(1)O(1)O(n)O(1)O(1)O(1)For a full binary-tree reference see Here
O(log n)O(log n)O(log n)Recursion | Iteration
----------------------------------|----------------------------------
recursive method (array, n) | iterative method (array)
if array[n] is not nil | for n from 0 to size of array
print array[n] | print(array[n])
recursive method(array, n+1) |
else |
exit loop |
greedy algorithm (array)
var largest difference = 0
var new difference = find next difference (array[n], array[n+1])
largest difference = new difference if new difference is > largest difference
repeat above two steps until all differences have been found
return largest difference
This algorithm never needed to compare all the differences to one another, saving it an entire iteration.
O(n^2)O(n^2)O(n^2)O(1)
(source: Wikipedia, Selection Sort)
O(n^2) time complexity, in practice it is slightly less since its comparison scheme only requires checking place if it is smaller than its neighbor.O(n)O(n^2)O(n^2)O(n)
(source: Wikipedia, Insertion Sort)
O(n log n)O(n log n)O(n)O(1)![]()
(source: Wikipedia, Merge Sort)
O(n^2)O(n log n)O(n log n)O(log n)
(source: Wikipedia, Quicksort)
Khan Academy's Algorithm Course Graph Data Structure & Algorithms Data Structure Interview Questions Data Structure MCQ With Answers 10 Best Data Structures and Algorithms Books
83 followers · starred Mar 2025
4,827 followers · starred Apr 2021
674 followers · starred Mar 2026
88 followers · starred Oct 2019