Concepts106

โš™๏ธAlgorithmIntermediate

MST Properties and Applications

An MST minimizes total edge weight over all spanning trees and has powerful properties such as the cut and cycle properties that guide correct, greedy construction.

#minimum spanning tree#kruskal#prim+12
โš™๏ธAlgorithmIntermediate

Minimum Spanning Tree - Prim

Prim's algorithm builds a Minimum Spanning Tree (MST) by growing a tree from an arbitrary start vertex, always adding the lightest edge that connects the tree to a new vertex.

#prim#minimum spanning tree#mst+12
โš™๏ธAlgorithmIntermediate

Bellman-Ford Algorithm

Bellmanโ€“Ford finds single-source shortest paths even when some edge weights are negative.

#bellman-ford#single-source shortest paths#negative weights+12
โš™๏ธAlgorithmIntermediate

Dijkstra - Variations and Applications

Dijkstraโ€™s algorithm can be adapted to track the second shortest path by keeping the best and second-best distances per vertex.

#dijkstra#second shortest path#k shortest paths+12
โš™๏ธAlgorithmIntermediate

Topological Sort - DP on DAG

Topological sort orders vertices of a directed acyclic graph (DAG) so every edge goes from earlier to later, which is perfect for dynamic programming (DP).

#topological sort#dag dp#longest path dag+12
โš™๏ธAlgorithmIntermediate

Breadth-First Search (BFS)

Breadth-First Search (BFS) explores a graph level by level, visiting all vertices at distance d from the source before any at distance d+1.

#bfs#breadth first search#graph traversal+12
โš™๏ธAlgorithmIntermediate

Multi-Source BFS

Multi-source BFS explores an unweighted graph starting from several sources at once to compute the minimum distance to any source for every vertex.

#multi-source bfs#graph algorithms#shortest path+11
โš™๏ธAlgorithmIntermediate

0-1 BFS

0-1 BFS is a shortest path algorithm specialized for graphs whose edge weights are only 0 or 1.

#0-1 bfs#binary weights#shortest path+12
โš™๏ธAlgorithmIntermediate

Depth-First Search (DFS)

Depth-First Search (DFS) explores a graph by going as deep as possible along each path before backtracking.

#depth-first search#dfs#graph traversal+12
โš™๏ธAlgorithmIntermediate

2D Prefix Sum

A 2D prefix sum (also called an integral image) lets you compute the sum of any axis-aligned sub-rectangle in constant time after O(nm) preprocessing.

#2d prefix sum#summed-area table#integral image+12
โš™๏ธAlgorithmIntermediate

Prefix Sum and Difference Array

Prefix sums precompute running totals so any range sum [l, r] can be answered in O(1) time as prefix[r] - prefix[l-1].

#prefix sum#difference array#imos method+12
โš™๏ธAlgorithmIntermediate

Sorting Algorithms

Sorting arranges items into a chosen order so that searching, grouping, and further algorithms become faster and simpler.

#sorting algorithms#merge sort#quicksort+12