Algorithm Complexity Cheat Sheet



Hey Finxters! Do you know what time it is? That’s right! It’s time for some more cheat sheets!! These cheat sheets are meant to help you on your way to becoming a great Python developer and of course becoming one of the best Python freelancers globally! This article is all about algorithms used in software development and the cheat sheets we will use to do this. Let’s get started without further delay!

Cheat Sheet 1: Princeton

This cheat sheet is one you will want to bookmark as it is part of an ebook! It primarily focuses on Algorithm and Data Structures.The area I would like you to focus is ⅓ of the way down beginning at arrays. Consider bookmarking the book(I have!) Chapter 4 deep dives into algorithms and data structures. It includes a list of the Python code structures used throughout the chapter with complete explanations on what is happening and the how!

Pros: Perfect for deep diving into Algorithm coding in Python!

1/22/14 Big-O Algorithm Complexity Cheat Sheet bigocheatsheet.com 1/17 I receive $12.19 / wk on Gittip. Big-O Cheat Sheet Searching Sorting Data Structures Heaps Graphs Chart Comments Tweet 2,710 1.7k Know Thy Complexities! This webpage covers the space and time Big-O complexities of common algorithms used in Computer Science. Algorithmic complexity is a measure of how long an algorithm would take to complete given an input of size n. If an algorithm has to scale, it should compute the result within a finite and practical time bound even for large values of n. For this reason, complexity is calculated asymptotically as n approaches infinity. While complexity is usually in terms of time, sometimes complexity is also. Big-O Algorithm Complexity Cheat Sheet (Know Thy Complexities!) @ericdrowell. Sorting algorithms time complexities. Saved by Daniel Pendergast. Big O Notation Bubble Sort Data Modeling Data Structures Cheat Sheets Sorting.

Cons: Part of an ebook

Cheat Sheet 2: AlgoDaily.com

This cheat sheet will go over the concepts of Big-O and Algorithmic complexity used in programming. Plus a video that discusses the concept! Algodaily is the place to be if you want to learn Algorithms and data structures for interviews to land a software career as a consultant or full time employee for a company.

Pros: Best place to learn everything you need to know for Algorithms and Data structures!

Cons: Does not have the ability to print, more structured towards interviews.

Cheat Sheet 3: Microsoft

This cheat sheet can be downloaded and pinned to the wall behind the monitor or place in your developers binder. It is carefully structured by microsoft to show you how to properly use algorithms for ML. Start in the What do you want to do box and you will be on your way to writing your algorithm!

Pros: Perfect place to start. It answers the question Where do I start?

Cons: None that I can see.

Cheat Sheet 4: Cheatography

This cheat sheet is all about sorting algorithms with boiler code included for bubble sorting, quicksort and selection. It presents a clear table of which is a method and which is a sorting algorithm. Print this one and keep it pinned to the wall or place it in your developers binder

Pros: Rated ‘E’ for everyone.

Algorithm Complexity Cheat Sheet

Cons: None that I can see.

Cheat Sheet 5: Medium

This cheat sheet is for learning the searching and sorting algorithms used in Python. It has code snippets, visuals on the different algorithms and explanations. This cheat sheet is on Medium, a fast up-coming developers source on information in the Development and IT field. Bookmark this page, since it doesn’t print.

Pros: Great place to begin learning sorting and searching algorithms.

Algorithm complexity cheat sheet pdf

Cons: You’ll have to subscribe to Medium to read this cheat sheet.

Cheat Sheet 6: Dummies

Here is another cheat sheet for you to bookmark, presented to you from the classic series How to for Dummies. It has tables for looking for, which has type, explanations and links for further explanations.

Pros: Perfect if you’re having a hard time understanding where to begin with your algorithms

Cons: Cannot be printed. Bookmark the page, I did.

Cheat Sheet 7: Packt

This is a pdf that you can print and pin to the wall behind the monitor! It has tables of the different algorithms, the data structures and graphs. Keep it handy when you are learning Big-O algorithms.

Pros: Rated ‘E’ for everyone.

Cons: You’ll have to go to Packt for the Big-O book to read.

Cheat Sheet 8: Analytics Vidhya

This cheat sheet is broken down into 2 sides with Python and R for machine learning algorithms for supervised, unsupervised and reinforcement learning. It has code examples to get you started for both languages.

Big O Cheat Sheet Pdf

Pros: Rated ‘E’ for everyone, contains 2 languages.

Cons: Save it as an image to your laptop before printing.

Cheat Sheet 9: Scikit Learn

This cheat sheet map uses Scikit Learn to point you towards the right estimator to try on your data sets.

Pros: Rated ‘E’ for everyone.

Cons: No code samples.

Cheat Sheet 10: SAS

This cheat sheet is used to help point you towards the correct algorithm to use for your data sets. The tutorial found online. Which machine learning algorithm do I use will help you make the correct choice.

Pros: Rated ‘E’ for everyone.

Cons: None that I can see.

This is just some of the cheat sheets I have found online and there are a ton more!! It is important to really understand Machine learning algorithms so I encourage you to sign up for a library (Packt is great!) and read the books they have available! To get you started I added a book from Pearsons! This book is an Introduction to Programming with Python! It covers Python from its basics to the algorithms and data structures you need to get you started! Keep on becoming a great Pythoner! One code at a time!

Related Articles:

Algorithm Complexity Cheat Sheet Answers

While working as a researcher in distributed systems, Dr. Christian Mayer found his love for teaching computer science students.

To help students reach higher levels of Python success, he founded the programming education website Finxter.com. He’s author of the popular programming book Python One-Liners (NoStarch 2020), coauthor of the Coffee Break Python series of self-published books, computer science enthusiast, freelancer, and owner of one of the top 10 largest Python blogs worldwide.

His passions are writing, reading, and coding. But his greatest passion is to serve aspiring coders through Finxter and help them to boost their skills. You can join his free email academy here.

Related Posts

When measuring the efficiency of an algorithm, we usually take into account the time and space complexity. In this article, we will glimpse those factors on some sorting algorithms and data structures, also we take a look at the growth rate of those operations.

Big-O Complexity Chart

First, we consider the growth rate of some familiar operations, based on this chart, we can visualize the difference of an algorithm with O(1) when compared with O(n2). As the input larger and larger, the growth rate of some operations stays steady, but some grow further as a straight line, some operations in the rest part grow as exponential, quadratic, factorial.

Sorting Algorithms

ComplexityCheat

In order to have a good comparison between different algorithms we can compare based on the resources it uses: how much time it needs to complete, how much memory it uses to solve a problem or how many operations it must do in order to solve the problem:

  • Time efficiency: a measure of the amount of time an algorithm takes to solve a problem.
  • Space efficiency: a measure of the amount of memory an algorithm needs to solve a problem.
  • Complexity theory: a study of algorithm performance based on cost functions of statement counts.
Sorting AlgorithmsSpace ComplexityTime Complexity
Worst case Best case Average case Worst case

Bubble Sort
O(1)O(n)O(n2)O(n2)
HeapsortO(1)O(n log n)O(n log n)O(n log n)
Insertion SortO(1)O(n)O(n2)O(n2)
MergesortO(n)O(n log n)O(n log n)O(n log n)
QuicksortO(log n)O(n log n)O(n log n)O(n log n)
Selection SortO(1)O(n2)O(n2)O(n2)
ShellSortO(1)O(n)O(n log n2)O(n log n2)
Smooth SortO(1)O(n)O(n log n)O(n log n)
Tree SortO(n)O(n log n)O(n log n)O(n2)
Counting SortO(k)O(n + k)O(n + k)O(n + k)
CubesortO(n)O(n)O(n log n)O(n log n)

Data Structure Operations

In this chart, we consult some popular data structures such as Array, Binary Tree, Linked-List with 3 operations Search, Insert and Delete.

Data StructuresAverage CaseWorst Case
SearchInsertDeleteSearchInsertDelete
ArrayO(n)N/AN/AO(n)N/AN/A
AVL TreeO(log n)O(log n)O(log n)O(log n)O(log n)O(log n)
B-TreeO(log n)O(log n)O(log n)O(log n)O(log n)O(log n)
Binary SearchTreeO(log n)O(log n)O(log n)O(n)O(n)O(n)
Doubly Linked ListO(n)O(1)O(1)O(n)O(1)O(1)
Hash tableO(1)O(1)O(1)O(n)O(n)O(n)
Linked ListO(n)O(1)O(1)O(n)O(1)O(1)
Red-Black treeO(log n)O(log n)O(log n)O(log n)O(log n)O(log n)
Sorted ArrayO(log n)O(n)O(n)O(log n)O(n)O(n)
StackO(n)O(1)O(1)O(n)O(1)O(1)

Growth of Functions

The order of growth of the running time of an algorithm gives a simple characterization of the algorithm’s efficiency and also allows us to compare the relative performance of alternative algorithms.

Below we have the function n f(n) with n as an input, and beside it we have some operations which take input n and return the total time to calculate some specific inputs.

Algorithm Complexity Cheat Sheet Printable

n f(n)log nnn log nn22nn!
100.003ns0.01ns0.033ns0.1ns1ns3.65ms
200.004ns0.02ns0.086ns0.4ns1ms77years
300.005ns0.03ns0.147ns0.9ns1sec8.4×1015yrs
400.005ns0.04ns0.213ns1.6ns18.3min
500.006ns0.05ns0.282ns2.5ns13days
1000.070.1ns0.644ns0.10ns4×1013yrs
1,0000.010ns1.00ns9.966ns1ms
10,0000.013ns10ns130ns100ms
100,0000.017ns0.10ms1.67ms10sec
1’000,0000.020ns1ms19.93ms16.7min
10’000,0000.023ns0.01sec0.23ms1.16days
100’000,0000.027ns0.10sec2.66sec115.7days
1,000’000,0000.030ns1sec29.90sec31.7 years