{"id":13632636,"url":"https://github.com/douchuan/algorithm","last_synced_at":"2025-04-18T05:32:42.982Z","repository":{"id":39858107,"uuid":"358614077","full_name":"douchuan/algorithm","owner":"douchuan","description":"Algorithms written in Rust","archived":false,"fork":false,"pushed_at":"2022-05-18T02:32:21.000Z","size":1397,"stargazers_count":576,"open_issues_count":2,"forks_count":59,"subscribers_count":14,"default_branch":"main","last_synced_at":"2024-08-01T22:54:01.521Z","etag":null,"topics":["algorithm","algorithms","algs4","computer-science","data-structures","graph-algorithms","interview","rust","rust-lang"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/douchuan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-16T13:48:44.000Z","updated_at":"2024-07-31T10:22:26.000Z","dependencies_parsed_at":"2022-07-15T05:16:42.658Z","dependency_job_id":null,"html_url":"https://github.com/douchuan/algorithm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/douchuan%2Falgorithm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/douchuan%2Falgorithm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/douchuan%2Falgorithm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/douchuan%2Falgorithm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/douchuan","download_url":"https://codeload.github.com/douchuan/algorithm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223775242,"owners_count":17200480,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","algorithms","algs4","computer-science","data-structures","graph-algorithms","interview","rust","rust-lang"],"created_at":"2024-08-01T22:03:09.544Z","updated_at":"2024-11-09T01:30:24.822Z","avatar_url":"https://github.com/douchuan.png","language":"Rust","readme":"### Overview \n\nThis repository contains the Rust source code \nfor the algorithms in the textbook \n[Algorithms, 4th Edition](http://amzn.to/13VNJi7) \nby Robert Sedgewick and Kevin Wayne.\n\nThe official Java source code is \n[here](https://github.com/kevin-wayne/algs4).\n\n### Goals\n\nMake a Rust implementation of the library so that\na Rust programmer can follow this book easily or\nprefer to demonstrate the algorithms using Rust.\n\nTry to keep the interface and variable name consistent\nwith the original book while writing idiomatic rust\ncode.\n\nI hope that this project helped you understand why \nRust is so wonderful and loved right now. Rust is proving \nto be a productive tool for reliable and efficient software. \nIn Rust, the compiler plays\na gatekeeper role by refusing to compile code with\nthese elusive bugs, including concurrency bugs.\nBy working alongside the compiler, you can spend your\ntime focusing on the program’s logic rather than\nchasing down bugs. After you finish a day's work,\ngo home and rest, can be at ease a good night's sleep,\nnever worry about system crash.\n\n### Index\n\nThe table index [follow](https://algs4.cs.princeton.edu/code/).\n\n| 1   | FUNDAMENTALS         |                                  |\n|-----|----------------------|----------------------------------|\n| 1.2 | Stack                | LIFO stack                       |\n| 1.3 | Queue                | FIFO queue                       |\n| 1.4 | LinkedList           | multiset (linked list)           |\n| 1.5 | QuickFindUF          | quick find                       |\n| -   | QuickUnionUF         | quick union                      |\n| -   | WeightedQuickUnionUF | weighted quick union             |\n| -   | UF                   | union-by-rank with path halving  |\n| 2   | SORTING              |                                  |\n| 2.1 | insert.rs            | insertion sort                   |\n| 2.2 | selection.rs         | selection sort                   |\n| 2.3 | shell.rs             | shellsort                        |\n| 2.4 | merge.rs             | Merge Sort                       |\n| 2.5 | quick.rs             | quicksort                        |\n| -   | Quick3Way            | quicksort with 3-way partitioning |\n| 2.6 | PQ::new_max_pq       | max heap priority queue          |\n| -   | PQ::new_min_pq       | min heap priority queue          |\n| -   | IndexPQ::new_min_pq  | index min heap priority queue    |\n| -   | IndexPQ::new_max_pq  | index max heap priority queue    |\n| -   | TopM                 | Find the largest M elements      |\n| 2.7 | floyd.rs             | heapsort                         |\n| 3   | SEARCHING            |                                  |\n| 3.4 | rb2.rs               | red-black tree                   |\n| 3.6 | SparseVector         | sparse vector                    |\n| 4   | GRAPHS               |                                  |\n| -   | Graph                | undirected graph                 |\n| -   | DepthFirstSearch     | depth-first search in a graph    | \n| -   | NonRecursiveDFS      | DFS in a graph (nonrecursive)    |\n| 4.1 | DepthFirstPaths      | paths in a graph (DFS)           |\n| 4.2 | BreadthFirstPaths    | paths in a graph (BFS)           |\n| 4.3 | CC                   | connected components of a graph  |\n| -   | Bipartite            | bipartite or odd cycle (DFS)     |\n| -   | Cycle                | cycle in a graph                 |\n| -   | SymbolGraph          | symbol graph                     |\n| -   | Digraph              | directed graph                   |\n| 4.4 | DepthFirstPaths      | paths in a digraph (DFS)         |\n| -   | BreadthFirstPaths    | paths in a digraph (BFS)         |\n| -   | DirectedCycle        | cycle in a digraph               |\n| 4.5 | Topological          | topological order in a DAG       |\n| -   | TransitiveClosure    | transitive closure               |\n| 4.6 | KosarajuSCC          | strong components (Kosaraju–Sharir) |\n| -   | EWGraph              | edge-weighted graph              |\n| -   | LazyPrimMST          | MST (lazy Prim)                  |\n| 4.7 | PrimMST              | MST (Prim)                       |\n| 4.8 | KruskalMST           | MST (Kruskal)                    |\n| -   | EdgeWeightedDigraphCycle | edge-weighted digraph        |\n| 4.9 | DijkstraSP           | shortest paths (Dijkstra)        |\n| -   | DijkstraAllPairsSP   | all-pairs shortest paths         |\n| 4.10 | AcyclicSP           | shortest paths in a DAG          |\n| -    | AcyclicLP           | longest paths in a DAG           |\n| -   | CPM                  | critical path method             |\n| 4.11 | BellmanFordSP       | shortest paths (Bellman–Ford)    |\n| -   | Arbitrage            | arbitrage detection              |\n| 5   | STRINGS              |                                  |\n| -   | Alphabet             | alphabet                         |\n| -   | count.rs             | alphabet client                  |\n| 5.1 | LSD                  | LSD radix sort                   |\n| 5.2 | MSD                  | MSD radix sort                   |\n| 5.3 | Quick3String         | 3-way string quicksort           |\n| 5.4 | TrieST               | multiway trie symbol table       |\n| 5.5 | TST                  | ternary search trie              |\n| 5.6 | KMP                  | substring search (Knuth–Morris–Pratt) |\n\n\n\n### Running\n\n```\n# setup Rust Toolchain\nmake test\n```\n\n### Roadmap\n\n- Implement algorithms in the textbook\n  [Algorithms, 4th Edition](http://amzn.to/13VNJi7)\n- Algorithms visualization (Easy to study and short learning curve)","funding_links":[],"categories":["Rust"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdouchuan%2Falgorithm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdouchuan%2Falgorithm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdouchuan%2Falgorithm/lists"}