diff --git a/algorithms/DFS.md b/algorithms/DFS.md index 7fda9724b..aea283730 100644 --- a/algorithms/DFS.md +++ b/algorithms/DFS.md @@ -1,11 +1,7 @@ --- title: Depth First Search Algorithm and Tree Properties category: algorithms -tags: - - graph theory - - depth first search - - spanning trees - - graph traversal +tags: graph theory, depth first search, spanning trees, graph traversal description: A technical explanation of Depth First Search (DFS) algorithm and its tree properties, including both recursive and iterative implementations. The document covers key properties of DFS trees, including the ancestor-descendant relationship of non-tree edges, and includes a formal lemma and proof about DFS tree characteristics. --- diff --git a/algorithms/approximation-algorithms.md b/algorithms/approximation-algorithms.md index 48011053c..96b815044 100644 --- a/algorithms/approximation-algorithms.md +++ b/algorithms/approximation-algorithms.md @@ -1,11 +1,7 @@ --- title: Approximation Algorithms category: algorithms -tags: - - approximation - - algorithms - - vertex cover - - set cover +tags: approximation, algorithms, vertex cover, set cover description: A survey of approximation algorithms, including the 2-approximation for vertex cover and the log(n) approximation for set cover. --- diff --git a/algorithms/bipartite-graphs.md b/algorithms/bipartite-graphs.md index 10eaf3f0a..5ed5a7351 100644 --- a/algorithms/bipartite-graphs.md +++ b/algorithms/bipartite-graphs.md @@ -1,11 +1,7 @@ --- title: Bipartite Graphs Properties, Proofs, and Detection Algorithm category: Graph Theory -tags: - - bipartite graphs - - graph coloring - - odd cycles - - breadth-first search +tags: bipartite graphs, graph coloring, odd cycles, breadth-first search description: A comprehensive overview of bipartite graphs, including their formal definition and key properties related to vertex coloring and odd-length cycles. The document presents important lemmas about the relationship between bipartite graphs and odd cycles, along with proofs using BFS layer analysis for bipartite graph detection. --- diff --git a/algorithms/connected-components.md b/algorithms/connected-components.md index f378493e9..b33358c36 100644 --- a/algorithms/connected-components.md +++ b/algorithms/connected-components.md @@ -1,11 +1,7 @@ --- title: Finding Connected Components in Undirected Graphs Using BFS/DFS category: algorithms -tags: - - graph theory - - connected components - - breadth-first search - - depth-first search +tags: graph theory, connected components, breadth-first search, depth-first search description: Explains how to partition an undirected graph into connected components using BFS or DFS algorithms in O(|V| + |E|) time complexity. Includes Python implementation using adjacency lists and demonstrates how to create a data structure that enables O(1) time queries for path existence between vertices. --- diff --git a/algorithms/dynamic-programming.md b/algorithms/dynamic-programming.md index 0a0329cb9..873560f20 100644 --- a/algorithms/dynamic-programming.md +++ b/algorithms/dynamic-programming.md @@ -1,11 +1,7 @@ --- title: Dynamic Programming Algorithms and Problem Solutions Guide category: algorithms -tags: - - dynamic-programming - - optimization - - algorithm-analysis - - problem-solving +tags: dynamic-programming, optimization, algorithm-analysis, problem-solving description: A comprehensive guide covering various dynamic programming algorithms and their implementations, including knapsack, sequence alignment, and tree-based problems. Includes detailed explanations of problem-solving approaches, correctness proofs, and runtime analysis for each algorithm, with practical Python implementations. --- diff --git a/algorithms/graphs-intro.md b/algorithms/graphs-intro.md index 8d8bf299c..90a9f3ec9 100644 --- a/algorithms/graphs-intro.md +++ b/algorithms/graphs-intro.md @@ -1,11 +1,7 @@ --- title: Introduction to Undirected Graphs and Their Properties category: Graph Theory -tags: - - graph fundamentals - - graph representation - - graph properties - - data structures +tags: graph, graph fundamentals, graph representation, graph properties, data structures description: A comprehensive introduction to undirected graphs covering fundamental concepts, properties, and storage methods. The document explains key terminology, proves important theorems about degree sums and odd vertices, and compares adjacency matrix and list representations with their respective time and space complexities. --- diff --git a/algorithms/greedy-algorithms.md b/algorithms/greedy-algorithms.md index 7398673cc..c4adaca93 100644 --- a/algorithms/greedy-algorithms.md +++ b/algorithms/greedy-algorithms.md @@ -1,22 +1,17 @@ --- title: Greedy Algorithms for Interval Scheduling and Partitioning category: Algorithm Analysis -tags: - - Greedy Algorithms - - Interval Scheduling - - Interval Partitioning - - Proof Techniques - - Optimization +tags: algorithms, interval, scheduling, partitioning, greedy-algorithms description: This document explores greedy algorithms for interval scheduling and partitioning problems. It provides detailed explanations of the algorithms, including Python implementations, and presents rigorous proofs of correctness using techniques such as "Greedy Stays Ahead" and exchange arguments. --- - # Greedy Algorithms +# Greedy Algorithms Choose the most attractive choice at each step, and hope that this will lead to the optimal solution. Proofs of correctness are particularly important for greedy algorithms. - ## Interval Scheduling +## Interval Scheduling - Job $j$ starts at $s(j)$ and finishes at $f(j)$. Two jobs are compatible if they don't overlap. The goal is to schedule as many jobs as possible without overlapping. +Job $j$ starts at $s(j)$ and finishes at $f(j)$. Two jobs are compatible if they don't overlap. The goal is to schedule as many jobs as possible without overlapping. Start by sorting the jobs with $f(j)$, and iterate over the jobs in order and choose as many jobs as you can. @@ -36,17 +31,17 @@ def interval_scheduling(jobs): Suppose the above algorithm has chosen jobs $f(i_1) \le f(i_2) \le \ldots \le f(i_k)$, and suppose $f(j_1) \le f(j_2) \le \ldots \le f(j_m)$. -*Goal:* $m \le k$ +_Goal:_ $m \le k$ -*Lemma*: $\forall r$, $f(i_r) \le f(j_r)$ +_Lemma_: $\forall r$, $f(i_r) \le f(j_r)$ -*Proof*: Induction, $P(r) := f(i_r) \le f(j_r)$ +_Proof_: Induction, $P(r) := f(i_r) \le f(j_r)$ -*Base Case*: $P(1)$. $i_1$ has the smallest finishing time. +_Base Case_: $P(1)$. $i_1$ has the smallest finishing time. -*IH*: Assume $P(r - 1)$ +_IH_: Assume $P(r - 1)$ -*IS*: Goal $P(r)$ +_IS_: Goal $P(r)$ Applying $P(r - 1)$, and using the fact that both sets of jobs chosen are non-overlapping within themselves, we have... @@ -99,6 +94,6 @@ def partition_intervals(I: list[tuple[int, int]]): Let $d$ be the number of classrooms the greedy algorithm uses. Classroom $d$ is then allocated because we needed to schedule a job, $j$, that is incompatible with all $d - 1$ previously allocated classrooms. -Since we sorted by start time, all these incompatible jobs must have started before $s(j)$, and thus we have $d$ lectures overlapping at time $s(j) + \epsilon$, so our maximum depth is $\ge d$. +Since we sorted by start time, all these incompatible jobs must have started before $s(j)$, and thus we have $d$ lectures overlapping at time $s(j) + \epsilon$, so our maximum depth is $\ge d$. Since we have that the optimal solution must schedule at least depth number of classrooms, we have that the greedy algorithm is optimal. diff --git a/algorithms/induction.md b/algorithms/induction.md index add452e87..c00efffa4 100644 --- a/algorithms/induction.md +++ b/algorithms/induction.md @@ -1,12 +1,7 @@ --- title: Mathematical Induction and Pigeonhole Principle Proofs category: Mathematics -tags: - - Induction - - Pigeonhole Principle - - Proof Techniques - - Number Theory - - Combinatorics +tags: induction, pigeonhole principle, proof techniques description: This document presents detailed proofs using mathematical induction and the pigeonhole principle. It demonstrates the inductive proof for the sum of natural numbers and provides a step-by-step proof of the pigeonhole principle, emphasizing the general approach to inductive reasoning in mathematics. --- diff --git a/algorithms/linear-programming.md b/algorithms/linear-programming.md index 4a9ad8595..c08068805 100644 --- a/algorithms/linear-programming.md +++ b/algorithms/linear-programming.md @@ -1,12 +1,7 @@ --- title: Linear Programming Fundamentals and Applications in Optimization category: Operations Research -tags: - - Linear Systems - - Linear Programs - - Optimization - - Standard Form - - Application Examples +tags: linear systems, linear programs, optimization description: This document provides a comprehensive overview of linear programming, covering linear systems, linear programs, and their standard forms. It explains key concepts such as hyperplanes, polytopes, and convex sets, and demonstrates how to transform various optimization problems into linear programs. The document also explores practical applications of linear programming in areas like max-flow and weighted vertex cover problems. --- diff --git a/algorithms/network-flows.md b/algorithms/network-flows.md index 70005004e..a7b443014 100644 --- a/algorithms/network-flows.md +++ b/algorithms/network-flows.md @@ -1,12 +1,7 @@ --- title: Network Flow Algorithms and Applications in Graph Theory category: Graph Theory -tags: - - Max Flow Min Cut - - Ford-Fulkerson Algorithm - - Bipartite Matching - - Vertex Cover - - Independent Set +tags: max flow min cut, ford-fulkerson algorithm, bipartite matching, vertex cover, independent set description: Comprehensive overview of network flow algorithms, including Max Flow/Min Cut and Ford-Fulkerson. Covers applications in bipartite matching, vertex cover, and independent set problems. Includes proofs, algorithms, and problem-solving techniques for graph theory concepts. --- diff --git a/algorithms/runtime.md b/algorithms/runtime.md index d7c2a10ef..2a6dcfb00 100644 --- a/algorithms/runtime.md +++ b/algorithms/runtime.md @@ -1,11 +1,7 @@ --- title: Measuring Algorithm Efficiency with Asymptotic Notation category: Computer Science -tags: - - Algorithm Analysis - - Time Complexity - - Asymptotic Notation - - Efficiency Bounds +tags: algorithm, time complexity, asymptotic notation, efficiency description: This document introduces methods for measuring algorithm efficiency using asymptotic notation. It defines O-notation, Omega-notation, and Theta-notation, and provides common efficiency bounds for various function types, emphasizing the importance of polynomial-time algorithms in practical computing. --- diff --git a/algorithms/stable-matching.md b/algorithms/stable-matching.md index 09a721096..ea4582a15 100644 --- a/algorithms/stable-matching.md +++ b/algorithms/stable-matching.md @@ -1,3 +1,10 @@ +--- +title: Stable Matching Algorithms and Proofs in Computer Science +category: Algorithm Analysis +tags: matching, stable matching, gale-shapley, proof techniques, complexity analysis, optimization +description: This document provides a comprehensive overview of stable matching algorithms, focusing on the Gale-Shapley algorithm and its properties. It includes detailed proofs of correctness, complexity analysis, and discussions on optimal assignments for companies and applicants. The document also explores related problems like the Stable Roommate Problem. +--- + # Stable Matching Given a list of $n$ companies $c_1, c_2, \ldots, c_n$, and a list of students $s_1, s_2, \ldots, s_n$, each company ranks the students in order of preference, and each student ranks the companies in order of preference. diff --git a/algorithms/tree-intro.md b/algorithms/tree-intro.md index 584bd09c1..012caac31 100644 --- a/algorithms/tree-intro.md +++ b/algorithms/tree-intro.md @@ -1,12 +1,7 @@ --- title: Tree Properties and Proof of Edge Count category: Graph Theory -tags: - - Trees - - Acyclic Graphs - - Connected Graphs - - Induction Proofs - - Graph Properties +tags: trees, acyclic graphs, connected graphs, induction proofs, graph properties description: This document explores the fundamental properties of trees in graph theory. It provides a proof by induction that a tree with n vertices has n-1 edges and outlines three key properties of trees, demonstrating their interconnected nature. --- diff --git a/site/algorithms/DFS.html b/site/algorithms/DFS.html index acd77bf77..9fafdaa0e 100644 --- a/site/algorithms/DFS.html +++ b/site/algorithms/DFS.html @@ -4,7 +4,7 @@