Giter VIP home page Giter VIP logo

rust-algorithm-club's Introduction

logo

Rust Algorithm Club

🚧 🚧 This repo is under construction. Most materials are written in Chinese. Check it out here if you are able to read Chinese.

Welcome to the Rust Algorithm Club! This repository was originally inspired by Swift Algorithm Club. All algorithms here would be explained and implemented in Rust programming language! You can find out more on the Rust Algorithm Club main site. Just pick up some algorithms you are interested in and start learning. If you are brave enough, we recommend you the auto-generated API documentation. Go and fight with the source code.

This project along with its source code are on GitHub and we are looking forward to your contributions.

Rust Edition Build Status Documentation

General Concepts

Algorithms

Searching

Sorting

Simple sorts:

Efficient sorts:

Hybrid sorts (more efficient):

Special-purpose sorts:

Data Structures

Stack and Queue

Linked List

Introduction to linked list

Associative Container

Introduction to associative container

String Manipulation

Learning Resources

For learning more, you may check out following online resources:

Contributing

All contributions are welcome, including typo fix! Please read the contrubuting guideline first before starting your work.

Contributors

License

This project is released under different licenses based on type of the content.

Copyright © 2017 - 2021 Weihang Lo

rust-algorithm-club's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rust-algorithm-club's Issues

Fill the emptiness of generated doc

The generated Rust doc is public now. Yet it seems too dumb and lack some descriptions. The crate and each modules need to be documented.

For crate doc itself, suppose we can reuse the English version of the root README.md file. Concerning module level docs, the Chinese articles are also absent. We should write down both English and Chinese intros for these three modules.

Any thought Rustaceans?

Missing Docs

  • crate itself
  • searching module
  • collections module
  • sorting module

Make get/get_mut/remove in HashMap more flexible with Borrow trait

I noticed the TODO message along with the helpful hints in the HashMap implementation:

/// Gets a reference to the value under the specified key.
///
/// TODO: To treat owned and borrowed values in equivalent ways as other
/// collections in std do, we should use `Borrow` trait to abstract over
/// the type of key to hash. This concept can also applied for `get_mut`
/// `remove`, and other operations that constrain by the type system.
///
/// Some useful resources:
///
/// - [Trait std::borrow:Borrow][1]
/// - [TRPL 1st edition: Borrow and AsRef][2]
///
/// # Complexity
///
/// Constant (amortized).
///
/// [1]: https://doc.rust-lang.org/stable/std/borrow/trait.Borrow.html
/// [2]: https://doc.rust-lang.org/stable/book/first-edition/borrow-and-asref.html
pub fn get(&self, key: &K) -> Option<&V> {
let index = self.make_hash(key);
self.buckets.get(index).and_then(|bucket|
bucket.iter()
.find(|(k, _)| *k == *key)
.map(|(_, v)| v)
)
}

if it's not currently under development, I would love to give it a try!

cargo checked failed for singly linked list

OS: macOS 10.14.1
rustc version: 1.28.0

    Checking rust-algorithm-club v0.0.1 (file:///Users/henry/Develop/rust-algorithm-club)
error[E0309]: the parameter type `T` may not live long enough
  --> src/collections/singly_linked_list/mod.rs:31:5
   |
30 | pub struct Iter<'a, T> {
   |                     - help: consider adding an explicit lifetime bound `T: 'a`...
31 |     next: Option<&'a Node<T>>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: ...so that the reference type `&'a collections::singly_linked_list::Node<T>` does not outlive the data it points at
  --> src/collections/singly_linked_list/mod.rs:31:5
   |
31 |     next: Option<&'a Node<T>>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0309]: the parameter type `T` may not live long enough
  --> src/collections/singly_linked_list/mod.rs:38:5
   |
37 | pub struct IterMut<'a, T> {
   |                        - help: consider adding an explicit lifetime bound `T: 'a`...
38 |     next: Option<&'a mut Node<T>>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: ...so that the reference type `&'a mut collections::singly_linked_list::Node<T>` does not outlive the data it points at
  --> src/collections/singly_linked_list/mod.rs:38:5
   |
38 |     next: Option<&'a mut Node<T>>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0309]: the parameter type `T` may not live long enough
   --> src/collections/singly_linked_list/mod.rs:229:5
    |
228 | impl<'a, T> Iterator for Iter<'a, T> {
    |          - help: consider adding an explicit lifetime bound `T: 'a`...
229 |     type Item = &'a T;
    |     ^^^^^^^^^^^^^^^^^^
    |
note: ...so that the reference type `&'a T` does not outlive the data it points at
   --> src/collections/singly_linked_list/mod.rs:229:5
    |
229 |     type Item = &'a T;
    |     ^^^^^^^^^^^^^^^^^^

error[E0309]: the parameter type `T` may not live long enough
   --> src/collections/singly_linked_list/mod.rs:242:5
    |
241 | impl<'a, T> Iterator for IterMut<'a, T> {
    |          - help: consider adding an explicit lifetime bound `T: 'a`...
242 |     type Item = &'a mut T;
    |     ^^^^^^^^^^^^^^^^^^^^^^
    |
note: ...so that the reference type `&'a mut T` does not outlive the data it points at
   --> src/collections/singly_linked_list/mod.rs:242:5
    |
242 |     type Item = &'a mut T;
    |     ^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0309`.
error: Could not compile `rust-algorithm-club`.

To learn more, run the command again with --verbose.

cargo check failed

error message

error: failed to parse manifest at `/Users/henry/Develop/rust-algorithm-club/Cargo.toml`

Caused by:
  editions are unstable

Caused by:
  feature `edition` is required

this Cargo does not support nightly features, but if you
switch to nightly channel you can add
`cargo-features = ["edition"]` to enable this feature

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.