[go: up one dir, main page]

0% found this document useful (0 votes)
10 views2 pages

Data Structures Algorithms Cheatsheet Tables

This cheatsheet provides an overview of various sorting and searching algorithms, detailing their time and space complexities. It includes sorting algorithms like Bubble Sort, Merge Sort, and Quick Sort, as well as searching methods such as Linear and Binary Search. Additionally, it covers graph traversal techniques like BFS and DFS, advanced pathfinding algorithms like Dijkstra’s and Bellman-Ford, and introduces dynamic programming concepts such as caching and memoization.

Uploaded by

stella luna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

Data Structures Algorithms Cheatsheet Tables

This cheatsheet provides an overview of various sorting and searching algorithms, detailing their time and space complexities. It includes sorting algorithms like Bubble Sort, Merge Sort, and Quick Sort, as well as searching methods such as Linear and Binary Search. Additionally, it covers graph traversal techniques like BFS and DFS, advanced pathfinding algorithms like Dijkstra’s and Bellman-Ford, and introduces dynamic programming concepts such as caching and memoization.

Uploaded by

stella luna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Data Structures & Algorithms Cheatsheet (Summary)

Sorting Algorithms – Time & Space Complexity


Algorithm Best Case Worst Case Space Complexity

Bubble Sort O(n) O(n²) O(1)

Selection Sort O(n²) O(n²) O(1)

Insertion Sort O(n) O(n²) O(1)

Merge Sort O(n log n) O(n log n) O(n)

Quick Sort O(n log n) O(n²) O(log n)

Searching Algorithms – Time Complexity


Algorithm Time Complexity Space Complexity

Linear Search O(n) O(1)

Binary Search O(log n) O(1)

Graph Traversal – Time & Space Complexity


Algorithm Time Complexity Space Complexity Use Case

BFS O(V+E) O(V) Shortest path in


unweighted graph

DFS O(V+E) O(V) Explore all paths,


cycle detection

Advanced Pathfinding – Time Complexity


Algorithm Graph Type Time Complexity Notes

Dijkstra’s Weighted (non- O((V+E) log V) Efficient, fast for


negative) sparse graphs

Bellman-Ford Weighted (with O(VE) Handles negative


negatives) weights

Dynamic Programming (DP)


 Break problem into smaller subproblems
 Store solutions to reuse (avoid recomputation)
 Caching = store data, Memoization = store function results

You might also like