Data Structures & Algorithms Cheat Sheet

This cheat sheet covers fundamental data structures and algorithms in computer science, categorized for quick reference.

Category Name Description
Data Structures Array Linear data structure with contiguous memory allocation.
Linked List Elements are linked using pointers in a linear order.
Stack LIFO data structure, elements are added and removed from the top.
Queue FIFO data structure, elements are added from the back and removed from the front.
Tree Hierarchical data structure with a root value and subtrees of children, represented as a set of linked nodes.
Binary Tree A tree data structure where each node has at most two children.
Graph A collection of nodes connected by edges.
Hash Table A data structure that implements an associative array, a structure that can map keys to values.
Algorithms Sorting Algorithms to arrange elements in a certain order. Includes Bubble Sort, Merge Sort, Quick Sort, etc.
Searching Algorithms to find elements. Includes Linear Search, Binary Search, etc.
Graph Traversal Algorithms to traverse or search through graph data structures. Includes Depth-First Search, Breadth-First Search, etc.
Path Finding Algorithms to find the shortest path between two nodes. Includes Dijkstra’s Algorithm, A* Algorithm, etc.
Dynamic Programming A method for solving complex problems by breaking them down into simpler subproblems.
Greedy Algorithms Algorithms that make the locally optimal choice at each stage with the hope of finding a global optimum.
Divide and Conquer Algorithms that divide the problem into subproblems, recursively solve them, and combine their solutions.
Backtracking An algorithmic-technique for solving problems recursively by trying to build a solution incrementally.
Branch and Bound A type of algorithm that systematically enumerates candidate solutions by means of state space search.
Randomized Algorithms Algorithms that use a degree of randomness as part of their logic.