Algorithms

  1. Graph Algorithms
    1. Graph Traversal Algorithms
      1. Breadth-First Search
        1. Algorithm Description
          1. Queue-Based Implementation
            1. Implementation Details
              1. Visited Array
                1. Queue Operations
                  1. Level Tracking
                  2. Time Complexity Analysis
                    1. Space Complexity Analysis
                      1. Applications
                        1. Shortest Path in Unweighted Graphs
                          1. Level-Order Traversal
                            1. Connected Components
                              1. Bipartite Graph Testing
                              2. Variants
                                1. Multi-Source BFS
                                  1. Bidirectional BFS
                                2. Depth-First Search
                                  1. Algorithm Description
                                    1. Implementation Approaches
                                      1. Recursive Implementation
                                        1. Iterative Implementation with Stack
                                        2. DFS Tree
                                          1. Tree Edges
                                            1. Back Edges
                                              1. Forward Edges
                                                1. Cross Edges
                                                2. Time Complexity Analysis
                                                  1. Space Complexity Analysis
                                                    1. Applications
                                                      1. Cycle Detection
                                                        1. Undirected Graphs
                                                          1. Directed Graphs
                                                          2. Topological Sorting
                                                            1. Algorithm Description
                                                            2. Connected Components
                                                              1. Undirected Graphs
                                                                1. Strongly Connected Components
                                                                2. Path Finding
                                                                  1. Maze Solving
                                                                  2. DFS Variants
                                                                    1. Iterative Deepening
                                                                3. Minimum Spanning Trees
                                                                  1. MST Problem Definition
                                                                    1. MST Properties
                                                                      1. Cut Property
                                                                        1. Cycle Property
                                                                          1. Uniqueness Conditions
                                                                          2. Kruskal's Algorithm
                                                                            1. Algorithm Description
                                                                              1. Greedy Strategy
                                                                                1. Disjoint Set Data Structure
                                                                                  1. Union-Find Operations
                                                                                    1. Path Compression
                                                                                      1. Union by Rank
                                                                                      2. Implementation
                                                                                        1. Time Complexity Analysis
                                                                                          1. Space Complexity
                                                                                            1. Correctness Proof
                                                                                            2. Prim's Algorithm
                                                                                              1. Algorithm Description
                                                                                                1. Greedy Strategy
                                                                                                  1. Priority Queue Implementation
                                                                                                    1. Min-Heap Usage
                                                                                                      1. Key Updates
                                                                                                      2. Implementation Variants
                                                                                                        1. Dense Graph Implementation
                                                                                                          1. Sparse Graph Implementation
                                                                                                          2. Time Complexity Analysis
                                                                                                            1. Space Complexity
                                                                                                              1. Correctness Proof
                                                                                                              2. Comparison of MST Algorithms
                                                                                                                1. Time Complexity
                                                                                                                  1. Space Complexity
                                                                                                                    1. Implementation Complexity
                                                                                                                      1. Practical Considerations
                                                                                                                      2. Applications
                                                                                                                        1. Network Design
                                                                                                                          1. Clustering
                                                                                                                            1. Approximation Algorithms
                                                                                                                          2. Shortest Path Algorithms
                                                                                                                            1. Single-Source Shortest Paths
                                                                                                                              1. Problem Definition
                                                                                                                                1. Shortest Path Properties
                                                                                                                                  1. Optimal Substructure
                                                                                                                                    1. Triangle Inequality
                                                                                                                                    2. Dijkstra's Algorithm
                                                                                                                                      1. Algorithm Description
                                                                                                                                        1. Greedy Strategy
                                                                                                                                          1. Priority Queue Implementation
                                                                                                                                            1. Min-Heap Operations
                                                                                                                                              1. Decrease-Key Operation
                                                                                                                                              2. Implementation Details
                                                                                                                                                1. Time Complexity Analysis
                                                                                                                                                  1. Space Complexity
                                                                                                                                                    1. Limitations
                                                                                                                                                      1. Non-Negative Weights Requirement
                                                                                                                                                      2. Correctness Proof
                                                                                                                                                        1. Variants
                                                                                                                                                          1. Single-Target Shortest Path
                                                                                                                                                            1. All-Pairs with Multiple Runs
                                                                                                                                                          2. Bellman-Ford Algorithm
                                                                                                                                                            1. Algorithm Description
                                                                                                                                                              1. Dynamic Programming Approach
                                                                                                                                                                1. Relaxation Process
                                                                                                                                                                  1. Implementation
                                                                                                                                                                    1. Time Complexity Analysis
                                                                                                                                                                      1. Space Complexity
                                                                                                                                                                        1. Handling Negative Weights
                                                                                                                                                                          1. Negative Cycle Detection
                                                                                                                                                                            1. Detection Method
                                                                                                                                                                              1. Reporting Negative Cycles
                                                                                                                                                                              2. Correctness Proof
                                                                                                                                                                                1. Applications
                                                                                                                                                                                  1. Currency Arbitrage
                                                                                                                                                                                    1. Network Routing
                                                                                                                                                                                2. All-Pairs Shortest Paths
                                                                                                                                                                                  1. Problem Definition
                                                                                                                                                                                    1. Floyd-Warshall Algorithm
                                                                                                                                                                                      1. Algorithm Description
                                                                                                                                                                                        1. Dynamic Programming Approach
                                                                                                                                                                                          1. Three-Dimensional DP Table
                                                                                                                                                                                            1. Implementation
                                                                                                                                                                                              1. Time Complexity Analysis
                                                                                                                                                                                                1. Space Complexity
                                                                                                                                                                                                  1. Path Reconstruction
                                                                                                                                                                                                    1. Handling Negative Cycles
                                                                                                                                                                                                      1. Applications
                                                                                                                                                                                                        1. Transitive Closure
                                                                                                                                                                                                          1. Graph Diameter
                                                                                                                                                                                                        2. Johnson's Algorithm
                                                                                                                                                                                                          1. Algorithm Description
                                                                                                                                                                                                            1. Reweighting Technique
                                                                                                                                                                                                              1. Bellman-Ford Preprocessing
                                                                                                                                                                                                                1. Multiple Dijkstra Runs
                                                                                                                                                                                                                  1. Implementation
                                                                                                                                                                                                                    1. Time Complexity Analysis
                                                                                                                                                                                                                      1. Use Cases
                                                                                                                                                                                                                        1. Sparse Graphs
                                                                                                                                                                                                                        2. Comparison with Floyd-Warshall
                                                                                                                                                                                                                      2. Shortest Path Variants
                                                                                                                                                                                                                        1. Single-Pair Shortest Path
                                                                                                                                                                                                                          1. k-Shortest Paths
                                                                                                                                                                                                                            1. Shortest Path with Constraints
                                                                                                                                                                                                                          2. Network Flow Algorithms
                                                                                                                                                                                                                            1. Flow Network Concepts
                                                                                                                                                                                                                              1. Flow Network Definition
                                                                                                                                                                                                                                1. Source and Sink
                                                                                                                                                                                                                                  1. Capacity Constraints
                                                                                                                                                                                                                                    1. Flow Conservation
                                                                                                                                                                                                                                      1. Net Flow
                                                                                                                                                                                                                                      2. Maximum Flow Problem
                                                                                                                                                                                                                                        1. Problem Definition
                                                                                                                                                                                                                                          1. Flow Properties
                                                                                                                                                                                                                                            1. Residual Networks
                                                                                                                                                                                                                                              1. Residual Capacity
                                                                                                                                                                                                                                                1. Augmenting Paths
                                                                                                                                                                                                                                                2. Ford-Fulkerson Method
                                                                                                                                                                                                                                                  1. Algorithm Framework
                                                                                                                                                                                                                                                    1. Augmenting Path Strategy
                                                                                                                                                                                                                                                      1. Implementation Approaches
                                                                                                                                                                                                                                                        1. Termination Conditions
                                                                                                                                                                                                                                                          1. Time Complexity Analysis
                                                                                                                                                                                                                                                          2. Edmonds-Karp Algorithm
                                                                                                                                                                                                                                                            1. BFS-Based Path Finding
                                                                                                                                                                                                                                                              1. Implementation
                                                                                                                                                                                                                                                                1. Time Complexity Improvement
                                                                                                                                                                                                                                                                2. Push-Relabel Algorithms
                                                                                                                                                                                                                                                                  1. Preflow Concept
                                                                                                                                                                                                                                                                    1. Height Functions
                                                                                                                                                                                                                                                                      1. Push and Relabel Operations
                                                                                                                                                                                                                                                                    2. Max-Flow Min-Cut Theorem
                                                                                                                                                                                                                                                                      1. Statement
                                                                                                                                                                                                                                                                        1. Proof Outline
                                                                                                                                                                                                                                                                          1. Applications
                                                                                                                                                                                                                                                                            1. Network Reliability
                                                                                                                                                                                                                                                                              1. Image Segmentation
                                                                                                                                                                                                                                                                            2. Minimum Cost Flow
                                                                                                                                                                                                                                                                              1. Problem Definition
                                                                                                                                                                                                                                                                                1. Cost-Augmenting Paths
                                                                                                                                                                                                                                                                                  1. Successive Shortest Path Algorithm
                                                                                                                                                                                                                                                                                  2. Applications
                                                                                                                                                                                                                                                                                    1. Bipartite Matching
                                                                                                                                                                                                                                                                                      1. Edge Connectivity
                                                                                                                                                                                                                                                                                        1. Vertex Connectivity
                                                                                                                                                                                                                                                                                          1. Project Selection