Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Big-O Cheat Sheet, Cheat Sheet of Computer Science

Big-O Cheat Sheet: Searching, Sorting, Data Structures

Typology: Cheat Sheet

2019/2020

Uploaded on 10/09/2020

ekaatma
ekaatma 🇺🇸

4.1

(30)

20 documents

Partial preview of the text

Download Big-O Cheat Sheet and more Cheat Sheet Computer Science in PDF only on Docsity! Big-O Cheat Sheet Generated December 10, 2013. Brandon Amos <http://bamos.github.io> 1 Searching Algorithm Data Structure Time Complexity Space Complexity Average Worst Depth First Search (DFS) Graph of |V | vertices and |E| edges - O (|E|+ |V |) O (|V |) Breadth First Search (BFS) Graph of |V | vertices and|E| edges - O (|E|+ |V |) O (|V |) Binary search Sorted array of n elements O (log(n)) O (log(n)) O (1) Linear (Brute Force) Array O (n) O (n) O (1) Shortest path by Dijkstra, using a Min-heap as prior- ity queue Graph with |V | vertices and |E| edges O ((|V |+ |E|) log |V |) O ((|V |+ |E|) log |V |) O (|V |) Shortest path by Dijkstra, using an unsorted array as priority queue Graph with |V | vertices and |E| edges O ( |V |2 ) O ( |V |2 ) O (|V |) Shortest path by Bellman- Ford Graph with |V | vertices and |E| edges O (|V ||E|) O (|V ||E|) O (|V |) 1
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved