[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-2225":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":25,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":35,"readmeContent":36,"aiSummary":37,"trendingCount":16,"starSnapshotCount":16,"syncStatus":38,"lastSyncTime":39,"discoverSource":40},2225,"algorithms","keon\u002Falgorithms","keon","Minimal examples of data structures and algorithms in Python","http:\u002F\u002Fkeon.kim\u002Falgorithms\u002F",null,"Python",25467,4721,615,1,0,3,7,25,10,82,"MIT License",false,"main",true,[27,5,28,29,30,31,32,33,34],"algorithm","competitive-programming","data-structure","graph","python","search","sort","tree","2026-06-12 04:00:13","[![PyPI version](https:\u002F\u002Fbadge.fury.io\u002Fpy\u002Falgorithms.svg)](https:\u002F\u002Fbadge.fury.io\u002Fpy\u002Falgorithms)\n[![Open Source Helpers](https:\u002F\u002Fwww.codetriage.com\u002Fkeon\u002Falgorithms\u002Fbadges\u002Fusers.svg)](https:\u002F\u002Fwww.codetriage.com\u002Fkeon\u002Falgorithms)\n\n# algorithms\n\nMinimal, clean, and well-documented implementations of data structures and algorithms in Python 3.\n\nEach file is self-contained with docstrings, type hints, and complexity notes &mdash; designed to be read and learned from.\n\n## Quick Start\n\n### Install\n\n```bash\npip install algorithms\n```\n\n### Use\n\n```python\nfrom algorithms.sorting import merge_sort\n\nprint(merge_sort([38, 27, 43, 3, 9, 82, 10]))\n# [3, 9, 10, 27, 38, 43, 82]\n```\n\n```python\nfrom algorithms.data_structures import BinaryHeap, Trie, BST\nfrom algorithms.graph import dijkstra, bellman_ford\nfrom algorithms.tree import TreeNode\n```\n\n### Examples\n\n**Graph &mdash; Dijkstra's shortest path:**\n\n```python\nfrom algorithms.graph import dijkstra\n\ngraph = {\n    \"s\": {\"a\": 2, \"b\": 1},\n    \"a\": {\"s\": 3, \"b\": 4, \"c\": 8},\n    \"b\": {\"s\": 4, \"a\": 2, \"d\": 2},\n    \"c\": {\"a\": 2, \"d\": 7, \"t\": 4},\n    \"d\": {\"b\": 1, \"c\": 11, \"t\": 5},\n    \"t\": {\"c\": 3, \"d\": 5},\n}\nprint(dijkstra(graph, \"s\", \"t\"))\n# (8, ['s', 'b', 'd', 't'])\n```\n\n**Dynamic programming &mdash; coin change:**\n\n```python\nfrom algorithms.dynamic_programming import count\n\n# Number of ways to make amount 10 using denominations [2, 5, 3, 6]\nprint(count([2, 5, 3, 6], 10))\n# 5\n```\n\n**Backtracking &mdash; generate permutations:**\n\n```python\nfrom algorithms.backtracking import permute\n\nprint(permute([1, 2, 3]))\n# [[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]\n```\n\n**Data structures &mdash; binary heap:**\n\n```python\nfrom algorithms.data_structures import BinaryHeap\n\nheap = BinaryHeap()\nfor val in [5, 3, 8, 1, 9]:\n    heap.insert(val)\nprint(heap.remove_min())  # 1\nprint(heap.remove_min())  # 3\n```\n\n**Searching &mdash; binary search:**\n\n```python\nfrom algorithms.searching import binary_search\n\nprint(binary_search([1, 3, 5, 7, 9, 11], 7))\n# 3   (index of target)\n```\n\n**Tree &mdash; inorder traversal:**\n\n```python\nfrom algorithms.tree import TreeNode\nfrom algorithms.tree import inorder\n\nroot = TreeNode(4)\nroot.left = TreeNode(2)\nroot.right = TreeNode(6)\nroot.left.left = TreeNode(1)\nroot.left.right = TreeNode(3)\n\nprint(inorder(root))\n# [1, 2, 3, 4, 6]\n```\n\n**String &mdash; Knuth-Morris-Pratt pattern matching:**\n\n```python\nfrom algorithms.string import knuth_morris_pratt\n\nprint(knuth_morris_pratt(\"abxabcabcaby\", \"abcaby\"))\n# 6   (starting index of match)\n```\n\n### Run Tests\n\n```bash\npython -m pytest tests\u002F\n```\n\n## Project Structure\n\n```\nalgorithms\u002F\n    data_structures\u002F     # Reusable data structure implementations\n    array\u002F               # Array manipulation algorithms\n    backtracking\u002F        # Constraint satisfaction & enumeration\n    bit_manipulation\u002F    # Bitwise operations & tricks\n    compression\u002F         # Encoding & compression schemes\n    dynamic_programming\u002F # Optimal substructure & memoization\n    graph\u002F               # Graph algorithms (BFS, DFS, shortest path, flow, ...)\n    greedy\u002F              # Greedy strategies\n    heap\u002F                # Heap-based algorithms\n    linked_list\u002F         # Linked list algorithms\n    map\u002F                 # Hash-map-based algorithms\n    math\u002F                # Number theory, combinatorics, algebra\n    matrix\u002F              # 2D array & linear algebra operations\n    queue\u002F               # Queue-based algorithms\n    searching\u002F           # Search algorithms (binary, linear, ...)\n    set\u002F                 # Set-based algorithms\n    sorting\u002F             # Sorting algorithms\n    stack\u002F               # Stack-based algorithms\n    streaming\u002F           # Streaming & sketching algorithms\n    string\u002F              # String matching, manipulation, parsing\n    tree\u002F                # Tree algorithms (traversal, BST ops, ...)\ntests\u002F                   # One test file per topic\n```\n\n## Data Structures\n\nAll core data structures live in [`algorithms\u002Fdata_structures\u002F`](algorithms\u002Fdata_structures):\n\n| Data Structure | Module | Key Classes |\n|---|---|---|\n| AVL Tree | `avl_tree.py` | `AvlTree` |\n| B-Tree | `b_tree.py` | `BTree` |\n| Binary Search Tree | `bst.py` | `BST` |\n| Fenwick Tree | `fenwick_tree.py` | `Fenwick_Tree` |\n| Graph | `graph.py` | `Node`, `DirectedEdge`, `DirectedGraph` |\n| Hash Table | `hash_table.py` | `HashTable`, `ResizableHashTable` |\n| Heap | `heap.py` | `BinaryHeap` |\n| KD Tree | `kd_tree.py` | `KDTree` |\n| Linked List | `linked_list.py` | `SinglyLinkedListNode`, `DoublyLinkedListNode` |\n| Priority Queue | `priority_queue.py` | `PriorityQueue` |\n| Queue | `queue.py` | `ArrayQueue`, `LinkedListQueue` |\n| Red-Black Tree | `red_black_tree.py` | `RBTree` |\n| Segment Tree | `segment_tree.py`, `iterative_segment_tree.py` | `SegmentTree` |\n| Separate Chaining Hash Table | `separate_chaining_hash_table.py` | `SeparateChainingHashTable` |\n| Sqrt Decomposition | `sqrt_decomposition.py` | `SqrtDecomposition` |\n| Stack | `stack.py` | `ArrayStack`, `LinkedListStack` |\n| Trie | `trie.py` | `Trie` |\n| Union-Find | `union_find.py` | `Union` |\n| vEB Tree | `veb_tree.py` | `VEBTree` |\n\n## Algorithms\n\n### Array\n\n- [delete_nth](algorithms\u002Farray\u002Fdelete_nth.py) &mdash; keep at most N occurrences of each element\n- [flatten](algorithms\u002Farray\u002Fflatten.py) &mdash; recursively flatten nested arrays into a single list\n- [garage](algorithms\u002Farray\u002Fgarage.py) &mdash; minimum swaps to rearrange a parking lot\n- [josephus](algorithms\u002Farray\u002Fjosephus.py) &mdash; eliminate every k-th person in a circular arrangement\n- [limit](algorithms\u002Farray\u002Flimit.py) &mdash; filter elements within min\u002Fmax bounds\n- [longest_non_repeat](algorithms\u002Farray\u002Flongest_non_repeat.py) &mdash; longest substring without repeating characters\n- [max_ones_index](algorithms\u002Farray\u002Fmax_ones_index.py) &mdash; find the zero to flip for the longest run of ones\n- [merge_intervals](algorithms\u002Farray\u002Fmerge_intervals.py) &mdash; combine overlapping intervals\n- [missing_ranges](algorithms\u002Farray\u002Fmissing_ranges.py) &mdash; find gaps between a low and high bound\n- [move_zeros](algorithms\u002Farray\u002Fmove_zeros.py) &mdash; move all zeros to the end, preserving order\n- [n_sum](algorithms\u002Farray\u002Fn_sum.py) &mdash; find all unique n-tuples that sum to a target\n- [plus_one](algorithms\u002Farray\u002Fplus_one.py) &mdash; add one to a number represented as a digit array\n- [remove_duplicates](algorithms\u002Farray\u002Fremove_duplicates.py) &mdash; remove duplicate elements preserving order\n- [rotate](algorithms\u002Farray\u002Frotate.py) &mdash; rotate an array right by k positions\n- [summarize_ranges](algorithms\u002Farray\u002Fsummarize_ranges.py) &mdash; summarize consecutive integers as range tuples\n- [three_sum](algorithms\u002Farray\u002Fthree_sum.py) &mdash; find all unique triplets that sum to zero\n- [top_1](algorithms\u002Farray\u002Ftop_1.py) &mdash; find the most frequently occurring values\n- [trimmean](algorithms\u002Farray\u002Ftrimmean.py) &mdash; compute mean after trimming extreme values\n- [two_sum](algorithms\u002Farray\u002Ftwo_sum.py) &mdash; find two indices whose values sum to a target\n\n### Backtracking\n\n- [add_operators](algorithms\u002Fbacktracking\u002Fadd_operators.py) &mdash; insert +, -, * between digits to reach a target\n- [anagram](algorithms\u002Fbacktracking\u002Fanagram.py) &mdash; check if two strings are anagrams\n- [array_sum_combinations](algorithms\u002Fbacktracking\u002Farray_sum_combinations.py) &mdash; find three-element combos from arrays that hit a target sum\n- [combination_sum](algorithms\u002Fbacktracking\u002Fcombination_sum.py) &mdash; find combinations (with reuse) that sum to a target\n- [factor_combinations](algorithms\u002Fbacktracking\u002Ffactor_combinations.py) &mdash; generate all factor combinations of a number\n- [find_words](algorithms\u002Fbacktracking\u002Ffind_words.py) &mdash; find words on a letter board via trie-based search\n- [generate_abbreviations](algorithms\u002Fbacktracking\u002Fgenerate_abbreviations.py) &mdash; generate all possible abbreviations of a word\n- [generate_parenthesis](algorithms\u002Fbacktracking\u002Fgenerate_parenthesis.py) &mdash; generate all valid parenthesis combinations\n- [letter_combination](algorithms\u002Fbacktracking\u002Fletter_combination.py) &mdash; phone keypad digit-to-letter combinations\n- [palindrome_partitioning](algorithms\u002Fbacktracking\u002Fpalindrome_partitioning.py) &mdash; partition a string into palindromic substrings\n- [pattern_match](algorithms\u002Fbacktracking\u002Fpattern_match.py) &mdash; match a string to a pattern via bijection mapping\n- [permute](algorithms\u002Fbacktracking\u002Fpermute.py) &mdash; generate all permutations of distinct elements\n- [permute_unique](algorithms\u002Fbacktracking\u002Fpermute_unique.py) &mdash; generate unique permutations when duplicates exist\n- [subsets](algorithms\u002Fbacktracking\u002Fsubsets.py) &mdash; generate all subsets (power set)\n- [minimax](algorithms\u002Fbacktracking\u002Fminimax.py) &mdash; game-tree search with alpha-beta pruning\n- [subsets_unique](algorithms\u002Fbacktracking\u002Fsubsets_unique.py) &mdash; generate unique subsets when duplicates exist\n\n### Bit Manipulation\n\n- [add_bitwise_operator](algorithms\u002Fbit_manipulation\u002Fadd_bitwise_operator.py) &mdash; add two integers using only bitwise operations\n- [binary_gap](algorithms\u002Fbit_manipulation\u002Fbinary_gap.py) &mdash; longest distance between consecutive 1-bits\n- [bit_operation](algorithms\u002Fbit_manipulation\u002Fbit_operation.py) &mdash; get, set, clear, and update individual bits\n- [bytes_int_conversion](algorithms\u002Fbit_manipulation\u002Fbytes_int_conversion.py) &mdash; convert between integers and byte sequences\n- [count_flips_to_convert](algorithms\u002Fbit_manipulation\u002Fcount_flips_to_convert.py) &mdash; count bit flips needed to convert one integer to another\n- [count_ones](algorithms\u002Fbit_manipulation\u002Fcount_ones.py) &mdash; count the number of 1-bits (Hamming weight)\n- [find_difference](algorithms\u002Fbit_manipulation\u002Ffind_difference.py) &mdash; find the added character between two strings using XOR\n- [find_missing_number](algorithms\u002Fbit_manipulation\u002Ffind_missing_number.py) &mdash; find a missing number in a sequence using XOR\n- [flip_bit_longest_sequence](algorithms\u002Fbit_manipulation\u002Fflip_bit_longest_sequence.py) &mdash; longest run of 1s after flipping a single 0\n- [gray_code](algorithms\u002Fbit_manipulation\u002Fgray_code.py) &mdash; generate Gray code sequences and convert between Gray and binary\n- [has_alternative_bit](algorithms\u002Fbit_manipulation\u002Fhas_alternative_bit.py) &mdash; check if binary representation has alternating bits\n- [insert_bit](algorithms\u002Fbit_manipulation\u002Finsert_bit.py) &mdash; insert bits at a specific position in an integer\n- [power_of_two](algorithms\u002Fbit_manipulation\u002Fpower_of_two.py) &mdash; check if an integer is a power of two\n- [remove_bit](algorithms\u002Fbit_manipulation\u002Fremove_bit.py) &mdash; remove a bit at a given position\n- [reverse_bits](algorithms\u002Fbit_manipulation\u002Freverse_bits.py) &mdash; reverse all 32 bits of an unsigned integer\n- [single_number](algorithms\u002Fbit_manipulation\u002Fsingle_number.py) &mdash; find the element appearing once (others appear twice) via XOR\n- [single_number2](algorithms\u002Fbit_manipulation\u002Fsingle_number2.py) &mdash; find the element appearing once (others appear three times)\n- [single_number3](algorithms\u002Fbit_manipulation\u002Fsingle_number3.py) &mdash; find two unique elements (others appear twice)\n- [subsets](algorithms\u002Fbit_manipulation\u002Fsubsets.py) &mdash; generate all subsets using bitmask enumeration\n- [swap_pair](algorithms\u002Fbit_manipulation\u002Fswap_pair.py) &mdash; swap adjacent bit pairs in an integer\n\n### Compression\n\n- [elias](algorithms\u002Fcompression\u002Felias.py) &mdash; Elias gamma and delta universal integer coding\n- [huffman_coding](algorithms\u002Fcompression\u002Fhuffman_coding.py) &mdash; variable-length prefix codes for lossless compression\n- [rle_compression](algorithms\u002Fcompression\u002Frle_compression.py) &mdash; run-length encoding for consecutive character compression\n\n### Dynamic Programming\n\n- [bitmask](algorithms\u002Fdynamic_programming\u002Fbitmask.py) &mdash; travelling salesman problem via bitmask dynamic programming\n- [buy_sell_stock](algorithms\u002Fdynamic_programming\u002Fbuy_sell_stock.py) &mdash; maximize profit from a stock price array\n- [climbing_stairs](algorithms\u002Fdynamic_programming\u002Fclimbing_stairs.py) &mdash; count ways to climb stairs taking 1 or 2 steps\n- [coin_change](algorithms\u002Fdynamic_programming\u002Fcoin_change.py) &mdash; minimum coins to make a given amount\n- [combination_sum](algorithms\u002Fdynamic_programming\u002Fcombination_sum.py) &mdash; count combinations that sum to a target (with reuse)\n- [count_paths_dp](algorithms\u002Fdynamic_programming\u002Fcount_paths_dp.py) &mdash; count paths in a grid using recursion, memoization, and bottom-up DP\n- [edit_distance](algorithms\u002Fdynamic_programming\u002Fedit_distance.py) &mdash; minimum edits to transform one string into another\n- [egg_drop](algorithms\u002Fdynamic_programming\u002Fegg_drop.py) &mdash; minimize trials to find the critical floor\n- [fibonacci](algorithms\u002Fdynamic_programming\u002Ffib.py) &mdash; compute Fibonacci numbers with memoization\n- [hosoya_triangle](algorithms\u002Fdynamic_programming\u002Fhosoya_triangle.py) &mdash; generate the Hosoya triangle of Fibonacci-like numbers\n- [house_robber](algorithms\u002Fdynamic_programming\u002Fhouse_robber.py) &mdash; maximize loot from non-adjacent houses\n- [int_divide](algorithms\u002Fdynamic_programming\u002Fint_divide.py) &mdash; count the number of integer partitions\n- [job_scheduling](algorithms\u002Fdynamic_programming\u002Fjob_scheduling.py) &mdash; maximize profit from weighted job scheduling\n- [k_factor](algorithms\u002Fdynamic_programming\u002Fk_factor.py) &mdash; find the k-factor of a string pattern\n- [knapsack](algorithms\u002Fdynamic_programming\u002Fknapsack.py) &mdash; maximize value under a weight constraint\n- [longest_common_subsequence](algorithms\u002Fdynamic_programming\u002Flongest_common_subsequence.py) &mdash; find the longest common subsequence of two strings\n- [longest_increasing](algorithms\u002Fdynamic_programming\u002Flongest_increasing.py) &mdash; find the longest increasing subsequence\n- [matrix_chain_order](algorithms\u002Fdynamic_programming\u002Fmatrix_chain_order.py) &mdash; minimize scalar multiplications for matrix chain\n- [max_product_subarray](algorithms\u002Fdynamic_programming\u002Fmax_product_subarray.py) &mdash; find the contiguous subarray with maximum product\n- [max_subarray](algorithms\u002Fdynamic_programming\u002Fmax_subarray.py) &mdash; maximum sum subarray (Kadane's algorithm)\n- [min_cost_path](algorithms\u002Fdynamic_programming\u002Fmin_cost_path.py) &mdash; minimum-cost path through a grid\n- [num_decodings](algorithms\u002Fdynamic_programming\u002Fnum_decodings.py) &mdash; count ways to decode a digit string into letters\n- [planting_trees](algorithms\u002Fdynamic_programming\u002Fplanting_trees.py) &mdash; optimize tree planting for maximum profit\n- [regex_matching](algorithms\u002Fdynamic_programming\u002Fregex_matching.py) &mdash; match a string against a pattern with `.` and `*` wildcards\n- [rod_cut](algorithms\u002Fdynamic_programming\u002Frod_cut.py) &mdash; maximize revenue from cutting a rod into pieces\n- [word_break](algorithms\u002Fdynamic_programming\u002Fword_break.py) &mdash; check if a string can be segmented into dictionary words\n\n### Graph\n\n- [a_star](algorithms\u002Fgraph\u002Fa_star.py) &mdash; heuristic shortest-path search (A* algorithm)\n- [all_factors](algorithms\u002Fgraph\u002Fall_factors.py) &mdash; find all factor combinations of a number\n- [all_pairs_shortest_path](algorithms\u002Fgraph\u002Fall_pairs_shortest_path.py) &mdash; Floyd-Warshall all-pairs shortest paths\n- [bellman_ford](algorithms\u002Fgraph\u002Fbellman_ford.py) &mdash; single-source shortest path with negative edge weights\n- [blossom](algorithms\u002Fgraph\u002Fblossom.py) &mdash; Edmonds' blossom algorithm for maximum matching in general graphs\n- [check_bipartite](algorithms\u002Fgraph\u002Fcheck_bipartite.py) &mdash; determine if a graph is two-colorable\n- [check_digraph_strongly_connected](algorithms\u002Fgraph\u002Fcheck_digraph_strongly_connected.py) &mdash; check if a directed graph is strongly connected\n- [clone_graph](algorithms\u002Fgraph\u002Fclone_graph.py) &mdash; deep-copy an undirected graph\n- [count_connected_number_of_component](algorithms\u002Fgraph\u002Fcount_connected_number_of_component.py) &mdash; count connected components in an undirected graph\n- [count_islands (BFS)](algorithms\u002Fgraph\u002Fcount_islands_bfs.py) &mdash; count islands in a grid using breadth-first search\n- [count_islands (DFS)](algorithms\u002Fgraph\u002Fcount_islands_dfs.py) &mdash; count islands in a grid using depth-first search\n- [count_islands (Union-Find)](algorithms\u002Fgraph\u002Fcount_islands_unionfind.py) &mdash; count islands using a disjoint-set structure\n- [cycle_detection](algorithms\u002Fgraph\u002Fcycle_detection.py) &mdash; detect cycles in a directed graph\n- [dijkstra](algorithms\u002Fgraph\u002Fdijkstra.py) &mdash; single-source shortest path for non-negative weights\n- [dijkstra_heapq](algorithms\u002Fgraph\u002Fdijkstra_heapq.py) &mdash; heap-optimised Dijkstra in O((V+E) log V) for sparse graphs\n- [find_all_cliques](algorithms\u002Fgraph\u002Ffind_all_cliques.py) &mdash; Bron-Kerbosch algorithm for finding all cliques\n- [find_path](algorithms\u002Fgraph\u002Ffind_path.py) &mdash; find paths between two vertices\n- [kahns_algorithm](algorithms\u002Fgraph\u002Fkahns_algorithm.py) &mdash; topological sort via in-degree counting (Kahn's)\n- [markov_chain](algorithms\u002Fgraph\u002Fmarkov_chain.py) &mdash; Markov chain probability modeling\n- [maximum_flow](algorithms\u002Fgraph\u002Fmaximum_flow.py) &mdash; compute maximum flow in a flow network\n- [maximum_flow (BFS)](algorithms\u002Fgraph\u002Fmaximum_flow_bfs.py) &mdash; Edmonds-Karp max-flow (BFS-based Ford-Fulkerson)\n- [maximum_flow (DFS)](algorithms\u002Fgraph\u002Fmaximum_flow_dfs.py) &mdash; Ford-Fulkerson max-flow via DFS augmenting paths\n- [maze_search (BFS)](algorithms\u002Fgraph\u002Fmaze_search_bfs.py) &mdash; find shortest path through a maze using BFS\n- [maze_search (DFS)](algorithms\u002Fgraph\u002Fmaze_search_dfs.py) &mdash; find a path through a maze using DFS\n- [minimum_spanning_tree](algorithms\u002Fgraph\u002Fminimum_spanning_tree.py) &mdash; Kruskal's minimum spanning tree\n- [pacific_atlantic](algorithms\u002Fgraph\u002Fpacific_atlantic.py) &mdash; find cells that can flow to both oceans\n- [path_between_two_vertices_in_digraph](algorithms\u002Fgraph\u002Fpath_between_two_vertices_in_digraph.py) &mdash; check if a path exists in a directed graph\n- [prims_minimum_spanning](algorithms\u002Fgraph\u002Fprims_minimum_spanning.py) &mdash; Prim's minimum spanning tree\n- [satisfiability](algorithms\u002Fgraph\u002Fsatisfiability.py) &mdash; 2-SAT satisfiability via implication graph\n- [shortest_distance_from_all_buildings](algorithms\u002Fgraph\u002Fshortest_distance_from_all_buildings.py) &mdash; find the optimal meeting point in a grid\n- [strongly_connected_components (Kosaraju)](algorithms\u002Fgraph\u002Fstrongly_connected_components_kosaraju.py) &mdash; Kosaraju's SCC algorithm\n- [sudoku_solver](algorithms\u002Fgraph\u002Fsudoku_solver.py) &mdash; solve a Sudoku puzzle using constraint backtracking\n- [tarjan](algorithms\u002Fgraph\u002Ftarjan.py) &mdash; Tarjan's strongly connected components algorithm\n- [topological_sort (BFS)](algorithms\u002Fgraph\u002Ftopological_sort_bfs.py) &mdash; topological ordering using BFS (Kahn's variant)\n- [topological_sort (DFS)](algorithms\u002Fgraph\u002Ftopological_sort_dfs.py) &mdash; topological ordering using DFS post-order\n- [transitive_closure (DFS)](algorithms\u002Fgraph\u002Ftransitive_closure_dfs.py) &mdash; compute the transitive closure of a graph\n- [traversal](algorithms\u002Fgraph\u002Ftraversal.py) &mdash; BFS and DFS graph traversal\n- [walls_and_gates](algorithms\u002Fgraph\u002Fwalls_and_gates.py) &mdash; fill each empty room with distance to nearest gate\n- [word_ladder](algorithms\u002Fgraph\u002Fword_ladder.py) &mdash; shortest word-to-word transformation sequence\n\n### Greedy\n\n- [gale_shapley](algorithms\u002Fgreedy\u002Fgale_shapley.py) &mdash; stable matching for bipartite preferences (Gale-Shapley)\n- [max_contiguous_subsequence_sum](algorithms\u002Fgreedy\u002Fmax_contiguous_subsequence_sum.py) &mdash; maximum contiguous subarray sum (Kadane's algorithm)\n\n### Heap\n\n- [k_closest_points](algorithms\u002Fheap\u002Fk_closest_points.py) &mdash; find k points closest to the origin\n- [merge_sorted_k_lists](algorithms\u002Fheap\u002Fmerge_sorted_k_lists.py) &mdash; merge k sorted linked lists using a min-heap\n- [skyline](algorithms\u002Fheap\u002Fskyline.py) &mdash; compute the skyline silhouette from building rectangles\n- [sliding_window_max](algorithms\u002Fheap\u002Fsliding_window_max.py) &mdash; maximum value in each sliding window position\n\n### Linked List\n\n- [add_two_numbers](algorithms\u002Flinked_list\u002Fadd_two_numbers.py) &mdash; add two numbers stored as reversed linked lists\n- [copy_random_pointer](algorithms\u002Flinked_list\u002Fcopy_random_pointer.py) &mdash; deep-copy a linked list with random pointers\n- [delete_node](algorithms\u002Flinked_list\u002Fdelete_node.py) &mdash; delete a node given only a reference to it\n- [first_cyclic_node](algorithms\u002Flinked_list\u002Ffirst_cyclic_node.py) &mdash; find the first node where a cycle begins (Floyd's)\n- [intersection](algorithms\u002Flinked_list\u002Fintersection.py) &mdash; find the intersection point of two singly linked lists\n- [is_cyclic](algorithms\u002Flinked_list\u002Fis_cyclic.py) &mdash; detect whether a linked list has a cycle\n- [is_palindrome](algorithms\u002Flinked_list\u002Fis_palindrome.py) &mdash; check if a linked list reads the same forwards and backwards\n- [is_sorted](algorithms\u002Flinked_list\u002Fis_sorted.py) &mdash; check if a linked list is sorted in order\n- [kth_to_last](algorithms\u002Flinked_list\u002Fkth_to_last.py) &mdash; find the k-th element from the end\n- [merge_two_list](algorithms\u002Flinked_list\u002Fmerge_two_list.py) &mdash; merge two sorted linked lists into one\n- [partition](algorithms\u002Flinked_list\u002Fpartition.py) &mdash; partition a list around a pivot value\n- [remove_duplicates](algorithms\u002Flinked_list\u002Fremove_duplicates.py) &mdash; remove duplicate values from a linked list\n- [remove_range](algorithms\u002Flinked_list\u002Fremove_range.py) &mdash; remove nodes within a given index range\n- [reverse](algorithms\u002Flinked_list\u002Freverse.py) &mdash; reverse a linked list iteratively and recursively\n- [rotate_list](algorithms\u002Flinked_list\u002Frotate_list.py) &mdash; rotate a list right by k positions\n- [swap_in_pairs](algorithms\u002Flinked_list\u002Fswap_in_pairs.py) &mdash; swap every two adjacent nodes\n\n### Map\n\n- [is_anagram](algorithms\u002Fmap\u002Fis_anagram.py) &mdash; check if two strings are anagrams via character counting\n- [is_isomorphic](algorithms\u002Fmap\u002Fis_isomorphic.py) &mdash; check if two strings have the same character mapping structure\n- [longest_common_subsequence](algorithms\u002Fmap\u002Flongest_common_subsequence.py) &mdash; longest common substring using a hash map\n- [longest_palindromic_subsequence](algorithms\u002Fmap\u002Flongest_palindromic_subsequence.py) &mdash; longest palindromic substring via hash map\n- [randomized_set](algorithms\u002Fmap\u002Frandomized_set.py) &mdash; O(1) insert, delete, and get-random data structure\n- [valid_sudoku](algorithms\u002Fmap\u002Fvalid_sudoku.py) &mdash; validate a Sudoku board configuration\n- [word_pattern](algorithms\u002Fmap\u002Fword_pattern.py) &mdash; check if a string follows a given pattern mapping\n\n### Math\n\n- [base_conversion](algorithms\u002Fmath\u002Fbase_conversion.py) &mdash; convert integers between arbitrary number bases\n- [chinese_remainder_theorem](algorithms\u002Fmath\u002Fchinese_remainder_theorem.py) &mdash; solve a system of modular congruences\n- [combination](algorithms\u002Fmath\u002Fcombination.py) &mdash; compute binomial coefficients (n choose r)\n- [cosine_similarity](algorithms\u002Fmath\u002Fcosine_similarity.py) &mdash; compute cosine similarity between two vectors\n- [decimal_to_binary_ip](algorithms\u002Fmath\u002Fdecimal_to_binary_ip.py) &mdash; convert an IP address between decimal and binary\n- [diffie_hellman_key_exchange](algorithms\u002Fmath\u002Fdiffie_hellman_key_exchange.py) &mdash; Diffie-Hellman cryptographic key exchange\n- [distance_between_two_points](algorithms\u002Fmath\u002Fdistance_between_two_points.py) &mdash; Euclidean distance in 2D space\n- [euler_totient](algorithms\u002Fmath\u002Feuler_totient.py) &mdash; count integers up to n that are coprime to n\n- [extended_gcd](algorithms\u002Fmath\u002Fextended_gcd.py) &mdash; extended Euclidean algorithm (GCD with coefficients)\n- [factorial](algorithms\u002Fmath\u002Ffactorial.py) &mdash; compute n! iteratively and recursively\n- [fft](algorithms\u002Fmath\u002Ffft.py) &mdash; Fast Fourier Transform (Cooley-Tukey)\n- [find_order_simple](algorithms\u002Fmath\u002Ffind_order_simple.py) &mdash; find the multiplicative order of an element mod n\n- [find_primitive_root_simple](algorithms\u002Fmath\u002Ffind_primitive_root_simple.py) &mdash; find a primitive root modulo a prime\n- [gcd](algorithms\u002Fmath\u002Fgcd.py) &mdash; greatest common divisor and least common multiple\n- [generate_strobogrammtic](algorithms\u002Fmath\u002Fgenerate_strobogrammtic.py) &mdash; generate strobogrammatic numbers of length n\n- [goldbach](algorithms\u002Fmath\u002Fgoldbach.py) &mdash; decompose an even number into a sum of two primes (Goldbach's conjecture)\n- [hailstone](algorithms\u002Fmath\u002Fhailstone.py) &mdash; Collatz conjecture (hailstone) sequence\n- [is_strobogrammatic](algorithms\u002Fmath\u002Fis_strobogrammatic.py) &mdash; check if a number looks the same upside-down\n- [krishnamurthy_number](algorithms\u002Fmath\u002Fkrishnamurthy_number.py) &mdash; check if a number equals the sum of the factorials of its digits\n- [linear_regression](algorithms\u002Fmath\u002Flinear_regression.py) &mdash; ordinary least-squares linear regression with R² and RMSE\n- [magic_number](algorithms\u002Fmath\u002Fmagic_number.py) &mdash; check if a number is a magic number\n- [manhattan_distance](algorithms\u002Fmath\u002Fmanhattan_distance.py) &mdash; compute Manhattan (L1) distance between two points in any dimension\n- [modular_exponential](algorithms\u002Fmath\u002Fmodular_exponential.py) &mdash; compute (base^exp) mod m efficiently\n- [modular_inverse](algorithms\u002Fmath\u002Fmodular_inverse.py) &mdash; compute the modular multiplicative inverse\n- [next_bigger](algorithms\u002Fmath\u002Fnext_bigger.py) &mdash; next larger number with the same digits\n- [next_perfect_square](algorithms\u002Fmath\u002Fnext_perfect_square.py) &mdash; find the next perfect square after n\n- [nth_digit](algorithms\u002Fmath\u002Fnth_digit.py) &mdash; find the n-th digit in the sequence 1, 2, 3, ...\n- [num_digits](algorithms\u002Fmath\u002Fnum_digits.py) &mdash; count the number of digits in an integer\n- [num_perfect_squares](algorithms\u002Fmath\u002Fnum_perfect_squares.py) &mdash; minimum perfect squares that sum to n\n- [polynomial](algorithms\u002Fmath\u002Fpolynomial.py) &mdash; polynomial and monomial arithmetic operations\n- [polynomial_division](algorithms\u002Fmath\u002Fpolynomial_division.py) &mdash; polynomial long division returning quotient and remainder\n- [power](algorithms\u002Fmath\u002Fpower.py) &mdash; compute x^n via binary exponentiation\n- [prime_check](algorithms\u002Fmath\u002Fprime_check.py) &mdash; check if a number is prime\n- [primes_sieve_of_eratosthenes](algorithms\u002Fmath\u002Fprimes_sieve_of_eratosthenes.py) &mdash; generate primes up to n using the Sieve of Eratosthenes\n- [pythagoras](algorithms\u002Fmath\u002Fpythagoras.py) &mdash; Pythagorean theorem calculations\n- [rabin_miller](algorithms\u002Fmath\u002Frabin_miller.py) &mdash; Miller-Rabin probabilistic primality test\n- [recursive_binomial_coefficient](algorithms\u002Fmath\u002Frecursive_binomial_coefficient.py) &mdash; binomial coefficient via Pascal's triangle recursion\n- [rsa](algorithms\u002Fmath\u002Frsa.py) &mdash; RSA public-key encryption and decryption\n- [sqrt_precision_factor](algorithms\u002Fmath\u002Fsqrt_precision_factor.py) &mdash; square root to arbitrary precision (Newton's method)\n- [summing_digits](algorithms\u002Fmath\u002Fsumming_digits.py) &mdash; recursively sum the digits of a number\n- [surface_area_of_torus](algorithms\u002Fmath\u002Fsurface_area_of_torus.py) &mdash; calculate the surface area of a torus\n- [symmetry_group_cycle_index](algorithms\u002Fmath\u002Fsymmetry_group_cycle_index.py) &mdash; cycle index polynomials for symmetry groups\n\n### Matrix\n\n- [bomb_enemy](algorithms\u002Fmatrix\u002Fbomb_enemy.py) &mdash; maximize enemies killed by a single bomb placement\n- [cholesky_matrix_decomposition](algorithms\u002Fmatrix\u002Fcholesky_matrix_decomposition.py) &mdash; Cholesky decomposition of a positive-definite matrix\n- [copy_transform](algorithms\u002Fmatrix\u002Fcopy_transform.py) &mdash; copy and transform a matrix\n- [count_paths](algorithms\u002Fmatrix\u002Fcount_paths.py) &mdash; count paths from top-left to bottom-right of a grid\n- [crout_matrix_decomposition](algorithms\u002Fmatrix\u002Fcrout_matrix_decomposition.py) &mdash; Crout's LU matrix decomposition\n- [matrix_exponentiation](algorithms\u002Fmatrix\u002Fmatrix_exponentiation.py) &mdash; raise a matrix to the n-th power efficiently\n- [matrix_inversion](algorithms\u002Fmatrix\u002Fmatrix_inversion.py) &mdash; compute the inverse of a square matrix\n- [multiply](algorithms\u002Fmatrix\u002Fmultiply.py) &mdash; standard and Strassen matrix multiplication\n- [rotate_image](algorithms\u002Fmatrix\u002Frotate_image.py) &mdash; rotate an n x n matrix 90 degrees in-place\n- [search_in_sorted_matrix](algorithms\u002Fmatrix\u002Fsearch_in_sorted_matrix.py) &mdash; search in a row- and column-sorted matrix\n- [sort_matrix_diagonally](algorithms\u002Fmatrix\u002Fsort_matrix_diagonally.py) &mdash; sort each diagonal of a matrix independently\n- [sparse_dot_vector](algorithms\u002Fmatrix\u002Fsparse_dot_vector.py) &mdash; dot product of two sparse vectors\n- [sparse_mul](algorithms\u002Fmatrix\u002Fsparse_mul.py) &mdash; multiply two sparse matrices efficiently\n- [spiral_traversal](algorithms\u002Fmatrix\u002Fspiral_traversal.py) &mdash; traverse a matrix in spiral order\n- [sudoku_validator](algorithms\u002Fmatrix\u002Fsudoku_validator.py) &mdash; validate that a Sudoku board follows all rules\n- [sum_sub_squares](algorithms\u002Fmatrix\u002Fsum_sub_squares.py) &mdash; sum of all k x k sub-squares in a matrix\n\n### Queue\n\n- [max_sliding_window](algorithms\u002Fqueue\u002Fmax_sliding_window.py) &mdash; maximum in each sliding window using a deque\n- [moving_average](algorithms\u002Fqueue\u002Fmoving_average.py) &mdash; compute a running moving average from a stream\n- [reconstruct_queue](algorithms\u002Fqueue\u002Freconstruct_queue.py) &mdash; reconstruct a queue from (height, count) pairs\n- [zigzagiterator](algorithms\u002Fqueue\u002Fzigzagiterator.py) &mdash; alternate elements from multiple iterators\n\n### Searching\n\n- [binary_search](algorithms\u002Fsearching\u002Fbinary_search.py) &mdash; search a sorted array in O(log n)\n- [exponential_search](algorithms\u002Fsearching\u002Fexponential_search.py) &mdash; search a sorted array by doubling the range then binary searching\n- [find_min_rotate](algorithms\u002Fsearching\u002Ffind_min_rotate.py) &mdash; find the minimum in a rotated sorted array\n- [first_occurrence](algorithms\u002Fsearching\u002Ffirst_occurrence.py) &mdash; find the first occurrence of a target value\n- [generalized_binary_search](algorithms\u002Fsearching\u002Fgeneralized_binary_search.py) &mdash; binary search with a custom predicate\n- [interpolation_search](algorithms\u002Fsearching\u002Finterpolation_search.py) &mdash; search using value-based interpolation\n- [jump_search](algorithms\u002Fsearching\u002Fjump_search.py) &mdash; search a sorted array by jumping in fixed blocks\n- [last_occurrence](algorithms\u002Fsearching\u002Flast_occurrence.py) &mdash; find the last occurrence of a target value\n- [linear_search](algorithms\u002Fsearching\u002Flinear_search.py) &mdash; sequential scan through an unsorted array\n- [next_greatest_letter](algorithms\u002Fsearching\u002Fnext_greatest_letter.py) &mdash; find the smallest letter greater than a target\n- [search_insert](algorithms\u002Fsearching\u002Fsearch_insert.py) &mdash; find the insertion position for a target value\n- [search_range](algorithms\u002Fsearching\u002Fsearch_range.py) &mdash; find the first and last positions of a target\n- [search_rotate](algorithms\u002Fsearching\u002Fsearch_rotate.py) &mdash; search in a rotated sorted array\n- [sentinel_search](algorithms\u002Fsearching\u002Fsentinel_search.py) &mdash; linear search optimized by placing a sentinel at the end\n- [ternary_search](algorithms\u002Fsearching\u002Fternary_search.py) &mdash; search by dividing the array into three parts\n- [two_sum](algorithms\u002Fsearching\u002Ftwo_sum.py) &mdash; find two numbers that sum to a target\n\n### Set\n\n- [find_keyboard_row](algorithms\u002Fset\u002Ffind_keyboard_row.py) &mdash; filter words that can be typed on one keyboard row\n- [randomized_set](algorithms\u002Fset\u002Frandomized_set.py) &mdash; O(1) insert, delete, and random-element access\n- [set_covering](algorithms\u002Fset\u002Fset_covering.py) &mdash; greedy approximation for the set cover problem\n\n### Sorting\n\n- [bead_sort](algorithms\u002Fsorting\u002Fbead_sort.py) &mdash; gravity-based natural sorting (bead\u002Fabacus sort)\n- [bitonic_sort](algorithms\u002Fsorting\u002Fbitonic_sort.py) &mdash; parallel-friendly comparison sort via bitonic sequences\n- [bogo_sort](algorithms\u002Fsorting\u002Fbogo_sort.py) &mdash; random permutation sort (intentionally inefficient)\n- [bubble_sort](algorithms\u002Fsorting\u002Fbubble_sort.py) &mdash; repeatedly swap adjacent out-of-order elements\n- [bucket_sort](algorithms\u002Fsorting\u002Fbucket_sort.py) &mdash; distribute elements into buckets, then sort each\n- [cocktail_shaker_sort](algorithms\u002Fsorting\u002Fcocktail_shaker_sort.py) &mdash; bidirectional bubble sort\n- [comb_sort](algorithms\u002Fsorting\u002Fcomb_sort.py) &mdash; bubble sort improved with a shrinking gap\n- [counting_sort](algorithms\u002Fsorting\u002Fcounting_sort.py) &mdash; sort integers by counting occurrences\n- [cycle_sort](algorithms\u002Fsorting\u002Fcycle_sort.py) &mdash; in-place sort that minimizes total writes\n- [exchange_sort](algorithms\u002Fsorting\u002Fexchange_sort.py) &mdash; simple pairwise comparison and exchange\n- [gnome_sort](algorithms\u002Fsorting\u002Fgnome_sort.py) &mdash; sort by swapping elements backward until ordered\n- [heap_sort](algorithms\u002Fsorting\u002Fheap_sort.py) &mdash; sort via a binary heap (in-place, O(n log n))\n- [insertion_sort](algorithms\u002Fsorting\u002Finsertion_sort.py) &mdash; build a sorted portion one element at a time\n- [meeting_rooms](algorithms\u002Fsorting\u002Fmeeting_rooms.py) &mdash; determine if meeting intervals overlap\n- [merge_sort](algorithms\u002Fsorting\u002Fmerge_sort.py) &mdash; divide-and-conquer stable sort (O(n log n))\n- [pancake_sort](algorithms\u002Fsorting\u002Fpancake_sort.py) &mdash; sort using only prefix reversals\n- [pigeonhole_sort](algorithms\u002Fsorting\u002Fpigeonhole_sort.py) &mdash; sort by placing elements into pigeonhole buckets\n- [quick_sort](algorithms\u002Fsorting\u002Fquick_sort.py) &mdash; partition-based divide-and-conquer sort\n- [radix_sort](algorithms\u002Fsorting\u002Fradix_sort.py) &mdash; non-comparative sort processing one digit at a time\n- [selection_sort](algorithms\u002Fsorting\u002Fselection_sort.py) &mdash; repeatedly select the minimum and swap it forward\n- [shell_sort](algorithms\u002Fsorting\u002Fshell_sort.py) &mdash; generalized insertion sort with a decreasing gap sequence\n- [sort_colors](algorithms\u002Fsorting\u002Fsort_colors.py) &mdash; Dutch national flag three-way partition\n- [stooge_sort](algorithms\u002Fsorting\u002Fstooge_sort.py) &mdash; recursive sort by dividing into overlapping thirds\n- [wiggle_sort](algorithms\u002Fsorting\u002Fwiggle_sort.py) &mdash; rearrange into an alternating peak-valley pattern\n\n### Stack\n\n- [is_consecutive](algorithms\u002Fstack\u002Fis_consecutive.py) &mdash; check if stack elements are consecutive integers\n- [is_sorted](algorithms\u002Fstack\u002Fis_sorted.py) &mdash; check if a stack is sorted in ascending order\n- [longest_abs_path](algorithms\u002Fstack\u002Flongest_abs_path.py) &mdash; find the longest absolute file path in a file system string\n- [ordered_stack](algorithms\u002Fstack\u002Fordered_stack.py) &mdash; maintain a stack in sorted order\n- [remove_min](algorithms\u002Fstack\u002Fremove_min.py) &mdash; remove the minimum element from a stack\n- [simplify_path](algorithms\u002Fstack\u002Fsimplify_path.py) &mdash; simplify a Unix-style file path\n- [stutter](algorithms\u002Fstack\u002Fstutter.py) &mdash; duplicate each element in a stack\n- [switch_pairs](algorithms\u002Fstack\u002Fswitch_pairs.py) &mdash; swap adjacent pairs of stack elements\n- [valid_parenthesis](algorithms\u002Fstack\u002Fvalid_parenthesis.py) &mdash; check for balanced parentheses \u002F brackets\n\n### Streaming\n\n- [misra_gries](algorithms\u002Fstreaming\u002Fmisra_gries.py) &mdash; approximate frequent-item detection in a data stream\n- [one_sparse_recovery](algorithms\u002Fstreaming\u002Fone_sparse_recovery.py) &mdash; recover a single non-zero element from a stream\n\n### String\n\n- [add_binary](algorithms\u002Fstring\u002Fadd_binary.py) &mdash; add two binary number strings\n- [alphabet_board_path](algorithms\u002Fstring\u002Falphabet_board_path.py) &mdash; navigate a 5×5 alphabet board to spell a target word\n- [atbash_cipher](algorithms\u002Fstring\u002Fatbash_cipher.py) &mdash; Atbash substitution cipher (reverse the alphabet)\n- [breaking_bad](algorithms\u002Fstring\u002Fbreaking_bad.py) &mdash; spell a string using periodic-table element symbols\n- [caesar_cipher](algorithms\u002Fstring\u002Fcaesar_cipher.py) &mdash; Caesar shift cipher encryption \u002F decryption\n- [check_pangram](algorithms\u002Fstring\u002Fcheck_pangram.py) &mdash; check if a string contains every letter of the alphabet\n- [contain_string](algorithms\u002Fstring\u002Fcontain_string.py) &mdash; find a substring in a string (strStr)\n- [count_binary_substring](algorithms\u002Fstring\u002Fcount_binary_substring.py) &mdash; count substrings with equal consecutive 0s and 1s\n- [decode_string](algorithms\u002Fstring\u002Fdecode_string.py) &mdash; decode a run-length encoded string like `3[a2[c]]`\n- [delete_reoccurring](algorithms\u002Fstring\u002Fdelete_reoccurring.py) &mdash; remove consecutive duplicate characters\n- [domain_extractor](algorithms\u002Fstring\u002Fdomain_extractor.py) &mdash; extract a domain name from a URL\n- [encode_decode](algorithms\u002Fstring\u002Fencode_decode.py) &mdash; encode and decode a list of strings\n- [first_unique_char](algorithms\u002Fstring\u002Ffirst_unique_char.py) &mdash; find the first non-repeating character\n- [fizzbuzz](algorithms\u002Fstring\u002Ffizzbuzz.py) &mdash; classic FizzBuzz problem\n- [group_anagrams](algorithms\u002Fstring\u002Fgroup_anagrams.py) &mdash; group strings that are anagrams of each other\n- [int_to_roman](algorithms\u002Fstring\u002Fint_to_roman.py) &mdash; convert an integer to a Roman numeral string\n- [is_palindrome](algorithms\u002Fstring\u002Fis_palindrome.py) &mdash; check if a string reads the same forwards and backwards\n- [is_rotated](algorithms\u002Fstring\u002Fis_rotated.py) &mdash; check if one string is a rotation of another\n- [judge_circle](algorithms\u002Fstring\u002Fjudge_circle.py) &mdash; determine if a sequence of moves returns to the origin\n- [knuth_morris_pratt](algorithms\u002Fstring\u002Fknuth_morris_pratt.py) &mdash; KMP linear-time pattern matching\n- [license_number](algorithms\u002Fstring\u002Flicense_number.py) &mdash; reformat a license key string with dashes\n- [longest_common_prefix](algorithms\u002Fstring\u002Flongest_common_prefix.py) &mdash; find the longest common prefix among strings\n- [longest_palindromic_substring](algorithms\u002Fstring\u002Flongest_palindromic_substring.py) &mdash; find the longest palindromic substring\n- [make_sentence](algorithms\u002Fstring\u002Fmake_sentence.py) &mdash; break a string into valid dictionary words\n- [manacher](algorithms\u002Fstring\u002Fmanacher.py) &mdash; find the longest palindromic substring in O(n) time\n- [merge_string_checker](algorithms\u002Fstring\u002Fmerge_string_checker.py) &mdash; check if a string is a valid merge of two others\n- [min_distance](algorithms\u002Fstring\u002Fmin_distance.py) &mdash; minimum deletions to make two strings equal\n- [multiply_strings](algorithms\u002Fstring\u002Fmultiply_strings.py) &mdash; multiply two numbers represented as strings\n- [one_edit_distance](algorithms\u002Fstring\u002Fone_edit_distance.py) &mdash; check if two strings are exactly one edit apart\n- [panagram](algorithms\u002Fstring\u002Fpanagram.py) &mdash; find missing letters to complete a pangram\n- [rabin_karp](algorithms\u002Fstring\u002Frabin_karp.py) &mdash; Rabin-Karp rolling-hash pattern matching\n- [repeat_string](algorithms\u002Fstring\u002Frepeat_string.py) &mdash; minimum string repeats to contain a substring\n- [repeat_substring](algorithms\u002Fstring\u002Frepeat_substring.py) &mdash; check if a string is built from a repeating pattern\n- [reverse_string](algorithms\u002Fstring\u002Freverse_string.py) &mdash; reverse a string in-place\n- [reverse_vowel](algorithms\u002Fstring\u002Freverse_vowel.py) &mdash; reverse only the vowels in a string\n- [reverse_words](algorithms\u002Fstring\u002Freverse_words.py) &mdash; reverse the order of words in a string\n- [roman_to_int](algorithms\u002Fstring\u002Froman_to_int.py) &mdash; convert a Roman numeral string to an integer\n- [rotate](algorithms\u002Fstring\u002Frotate.py) &mdash; rotate a string by k positions\n- [strip_url_params](algorithms\u002Fstring\u002Fstrip_url_params.py) &mdash; remove duplicate query parameters from a URL\n- [swap_characters](algorithms\u002Fstring\u002Fswap_characters.py) &mdash; check if one character swap can make two strings equal\n- [strong_password](algorithms\u002Fstring\u002Fstrong_password.py) &mdash; check minimum changes needed for a strong password\n- [text_justification](algorithms\u002Fstring\u002Ftext_justification.py) &mdash; justify text lines to a specified width\n- [unique_morse](algorithms\u002Fstring\u002Funique_morse.py) &mdash; count unique Morse code representations of words\n- [validate_coordinates](algorithms\u002Fstring\u002Fvalidate_coordinates.py) &mdash; validate geographic latitude\u002Flongitude coordinates\n- [word_squares](algorithms\u002Fstring\u002Fword_squares.py) &mdash; find all valid word squares from a word list\n- [z_algorithm](algorithms\u002Fstring\u002Fz_algorithm.py) &mdash; Z-array computation for linear-time pattern matching\n\n### Tree\n\n- [bin_tree_to_list](algorithms\u002Ftree\u002Fbin_tree_to_list.py) &mdash; convert a binary tree to a doubly linked list\n- [binary_tree_paths](algorithms\u002Ftree\u002Fbinary_tree_paths.py) &mdash; enumerate all root-to-leaf paths\n- [binary_tree_views](algorithms\u002Ftree\u002Fbinary_tree_views.py) &mdash; left, right, top, and bottom views of a binary tree\n- [bst_array_to_bst](algorithms\u002Ftree\u002Fbst_array_to_bst.py) &mdash; convert a sorted array into a height-balanced BST\n- [bst_closest_value](algorithms\u002Ftree\u002Fbst_closest_value.py) &mdash; find the value closest to a target in a BST\n- [bst_count_left_node](algorithms\u002Ftree\u002Fbst_count_left_node.py) &mdash; count the number of left-child nodes\n- [bst_delete_node](algorithms\u002Ftree\u002Fbst_delete_node.py) &mdash; delete a node from a BST while preserving order\n- [bst_depth_sum](algorithms\u002Ftree\u002Fbst_depth_sum.py) &mdash; sum of node values weighted by their depth\n- [bst_height](algorithms\u002Ftree\u002Fbst_height.py) &mdash; calculate the height of a binary tree\n- [bst_is_bst](algorithms\u002Ftree\u002Fbst_is_bst.py) &mdash; validate the binary search tree property\n- [bst_iterator](algorithms\u002Ftree\u002Fbst_iterator.py) &mdash; lazy in-order iterator for a BST\n- [bst_kth_smallest](algorithms\u002Ftree\u002Fbst_kth_smallest.py) &mdash; find the k-th smallest element in a BST\n- [bst_lowest_common_ancestor](algorithms\u002Ftree\u002Fbst_lowest_common_ancestor.py) &mdash; lowest common ancestor exploiting BST ordering\n- [bst_num_empty](algorithms\u002Ftree\u002Fbst_num_empty.py) &mdash; count empty (null) branches in a tree\n- [bst_predecessor](algorithms\u002Ftree\u002Fbst_predecessor.py) &mdash; find the in-order predecessor of a BST node\n- [bst_serialize_deserialize](algorithms\u002Ftree\u002Fbst_serialize_deserialize.py) &mdash; serialize a BST to a string and back\n- [bst_successor](algorithms\u002Ftree\u002Fbst_successor.py) &mdash; find the in-order successor of a BST node\n- [bst_unique_bst](algorithms\u002Ftree\u002Fbst_unique_bst.py) &mdash; count structurally unique BSTs for n keys (Catalan number)\n- [bst_validate_bst](algorithms\u002Ftree\u002Fbst_validate_bst.py) &mdash; validate a BST using min\u002Fmax range constraints\n- [construct_tree_postorder_preorder](algorithms\u002Ftree\u002Fconstruct_tree_postorder_preorder.py) &mdash; reconstruct a tree from pre-order and post-order traversals\n- [deepest_left](algorithms\u002Ftree\u002Fdeepest_left.py) &mdash; find the deepest left leaf node\n- [invert_tree](algorithms\u002Ftree\u002Finvert_tree.py) &mdash; mirror a binary tree (swap all left\u002Fright children)\n- [is_balanced](algorithms\u002Ftree\u002Fis_balanced.py) &mdash; check if a tree is height-balanced\n- [is_subtree](algorithms\u002Ftree\u002Fis_subtree.py) &mdash; check if one tree is a subtree of another\n- [is_symmetric](algorithms\u002Ftree\u002Fis_symmetric.py) &mdash; check if a tree is a mirror of itself\n- [longest_consecutive](algorithms\u002Ftree\u002Flongest_consecutive.py) &mdash; longest consecutive-value sequence in a tree\n- [lowest_common_ancestor](algorithms\u002Ftree\u002Flowest_common_ancestor.py) &mdash; find the lowest common ancestor of two nodes\n- [max_height](algorithms\u002Ftree\u002Fmax_height.py) &mdash; maximum depth (height) of a binary tree\n- [max_path_sum](algorithms\u002Ftree\u002Fmax_path_sum.py) &mdash; maximum sum along any path between two nodes\n- [min_height](algorithms\u002Ftree\u002Fmin_height.py) &mdash; minimum depth from root to the nearest leaf\n- [path_sum](algorithms\u002Ftree\u002Fpath_sum.py) &mdash; check if any root-to-leaf path sums to a target\n- [path_sum2](algorithms\u002Ftree\u002Fpath_sum2.py) &mdash; find all root-to-leaf paths that sum to a target\n- [pretty_print](algorithms\u002Ftree\u002Fpretty_print.py) &mdash; pretty-print a binary tree to the console\n- [same_tree](algorithms\u002Ftree\u002Fsame_tree.py) &mdash; check if two binary trees are structurally identical\n- [traversal_inorder](algorithms\u002Ftree\u002Ftraversal_inorder.py) &mdash; in-order traversal (left, root, right)\n- [traversal_level_order](algorithms\u002Ftree\u002Ftraversal_level_order.py) &mdash; level-order (breadth-first) traversal\n- [traversal_postorder](algorithms\u002Ftree\u002Ftraversal_postorder.py) &mdash; post-order traversal (left, right, root)\n- [traversal_preorder](algorithms\u002Ftree\u002Ftraversal_preorder.py) &mdash; pre-order traversal (root, left, right)\n- [traversal_zigzag](algorithms\u002Ftree\u002Ftraversal_zigzag.py) &mdash; zigzag (alternating direction) level-order traversal\n- [trie_add_and_search](algorithms\u002Ftree\u002Ftrie_add_and_search.py) &mdash; trie with wildcard `.` search support\n\n## Contributing\n\nThanks for your interest in contributing! There are many ways to get involved. See [CONTRIBUTING.md](CONTRIBUTING.md) for details.\n\n## Maintainers\n\n- [Keon Kim](https:\u002F\u002Fgithub.com\u002Fkeon)\n\n## Contributors\n\nThanks to [all the contributors](https:\u002F\u002Fgithub.com\u002Fkeon\u002Falgorithms\u002Fgraphs\u002Fcontributors) who helped build this repo.\n\n## License\n\n[MIT](LICENSE)\n","keon\u002Falgorithms 是一个用 Python 实现的简洁明了的数据结构和算法示例库。该项目提供了包括排序、搜索、图论、动态规划等在内的多种经典算法及数据结构的实现，每段代码都附有详细的文档说明、类型提示以及时间复杂度分析，便于学习与理解。适合于编程竞赛准备、算法学习或作为教学资源使用。支持通过 pip 安装，并可直接导入使用各类算法和数据结构。MIT 许可下开源，拥有广泛的社区支持。",2,"2026-06-11 02:48:58","top_language"]