Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more algorithms in Rust Language #3

Closed
12 tasks
r0hit-gupta opened this issue Sep 19, 2018 · 60 comments
Closed
12 tasks

Add more algorithms in Rust Language #3

r0hit-gupta opened this issue Sep 19, 2018 · 60 comments
Labels
enhancement New feature or request stale

Comments

@r0hit-gupta
Copy link
Member

r0hit-gupta commented Sep 19, 2018

This issue is fairly easy and most beginners should be comfortable implementing algorithms of their choice in Rust. In case of any problem, raise an issue or just discuss it below.

Graphs

  • DFS

Dynamic Programming

  • Longest increasing subsequence()
  • Rod cut
  • Egg Dropping Puzzle

Data Structures

  • Graph
    • Directed
    • Undirected
  • Trie
  • AVL Tree

General

  • N-Queens
  • Graph Coloring
  • Run Length Encoding

Project Euler, LeetCode, etc.

  • Currently, we don't accept problems from those and similar websites
@0xazure
Copy link

0xazure commented Oct 1, 2018

@r0hit-gupta I'm still getting my feet wet with Rust, but I wouldn't mind taking a stab at insertion & selection sort along with some tests for them.

@nlynchjo
Copy link

nlynchjo commented Oct 1, 2018

@r0hit-gupta I am also looking for a first time contribution! Mind if I take on some of the data structures?

@r0hit-gupta
Copy link
Member Author

@0xazure @nlynchjo Please feel free to contribute and work on anything you like. Take an idea from other repositories if you do not know how to begin. Send a pull request and if there is something not right, we will let you know. Cheers!

@darkkeh
Copy link

darkkeh commented Oct 1, 2018

@r0hit-gupta I'll take a crack at the KMP string pattern matching 👍

@bofh69
Copy link
Contributor

bofh69 commented Oct 1, 2018

@0xazure - sorry, I didn't read your comment until now. I just added a PR with insertion sort.

@0xazure
Copy link

0xazure commented Oct 1, 2018

@bofh69 thanks for letting me know! I hadn't actually started implementing it yet, so I'll focus on the selection sort. I'm definitely interested in how you did it in Rust, so I'll have a look at your PR!

@bofh69
Copy link
Contributor

bofh69 commented Oct 1, 2018

@0xazure Great! I felt a bit stupid not checking the comments here first...
My solution is probably not the best, I'm still learning Rust, but now it is decent.

@eisterman
Copy link

I'm actually working on Merge Sort

@AnshulMalik
Copy link
Member

I think there is already a PR for Merge Sort @eisterman

@Jay9596
Copy link

Jay9596 commented Oct 2, 2018

I'd like to work on implementing Queue, if no one has claimed it.

@AnshulMalik
Copy link
Member

Go ahead @Jay9596 :)

@teskje
Copy link
Contributor

teskje commented Oct 2, 2018

I'd like to try my hands on heap sort.

This was referenced Oct 3, 2018
@DanielSauve
Copy link

I'll take a shot at making a Stack

@sn99 sn99 mentioned this issue Oct 4, 2018
@BaxterEaves
Copy link
Contributor

I'm up for k-means, but i'm not aware of a dynamic programming algorithm for data with more than one dimension. I can implement the more general iterative algorithm if you like.

@pickfire
Copy link
Contributor

pickfire commented Oct 6, 2018

I am interested in caesar cipher.

@AnshulMalik
Copy link
Member

Give it a try @BaxterEaves and @pickfire 👍

@elpiel
Copy link
Contributor

elpiel commented Oct 28, 2018

I've added another Merge Sort implementation, I will try to do some other as well PR #57
PS: I didn't see that it's already implemented 😁

Update:
Binary tree PR #58

@elpiel elpiel mentioned this issue Oct 28, 2018
@pickfire
Copy link
Contributor

@AnshulMalik I have added the caesar cipher #55

This was referenced Oct 28, 2018
@erfan-khadem
Copy link
Contributor

erfan-khadem commented Mar 10, 2022

I think we can implement some items on this list:

Math

Graph and Trees

Searching

Strings

  • Suffix array, suffix tree

I'm sure I'm missing many algorithms.

@mime8
Copy link
Contributor

mime8 commented Mar 20, 2022

Hi, all! I'd like to work on ternary search algorithm, if no one else is working on it.

@erfan-khadem
Copy link
Contributor

erfan-khadem commented Mar 21, 2022

Hi, all! I'd like to work on ternary search algorithm, if no one else is working on it.

Awesome! I added your name to the list.

@b42thomas
Copy link

Hey y'all, I'm looking to make my first contribution. I would like to work on the matrix operations. Should that be separated into different PRs for addition, subtraction and multiplication?

@siriak
Copy link
Member

siriak commented Mar 22, 2022

@b42thomas depending on how complex they are. If you're implementing naive approaches, they can be merged together, if some complex algorithms, better to do them separately

@erfan-khadem
Copy link
Contributor

@siriak I have a question:
I want to implement a few graph algorithms, and if they are represented using BTreeMap, a log(n) factor would be added to their time complexity (obviously.) So can I only implement the algorithms for graphs with vertices numbered from 1 to n and having &[Vec<usize>] as their adjacency list?

I know we are supposed to create generic algorithms, but adding a log(n) to max flow wouldn't make anyone happy.

@siriak
Copy link
Member

siriak commented Mar 25, 2022

@er888kh, I think we can have both versions. Depending on the task at hand, both can be useful.

@erfan-khadem
Copy link
Contributor

@er888kh, I think we can have both versions. Depending on the task at hand, both can be useful.

That's certainly an option, but it would create a lot of duplication (or at least generics boiler plate)

Another solution is to have a seperate implementation that enumerates graphs represented using BTreeMap to a convenient representation. Then anyone can use that instead. As an added bonus, this solution wouldn't change the time complexity, as iterating over a BTree can be done in O(n).

I will implement the option you choose (my code wouldn't be ready for at least a few days though, I'm too busy)

@siriak
Copy link
Member

siriak commented Mar 26, 2022

Agree, let's implement for the from 1 to n case then

@mime8
Copy link
Contributor

mime8 commented Mar 30, 2022

While my PR for ternary search is still in review, I'd like to work on Ternary Search Tree. I don't see this data structure in the project.

@mhorst00
Copy link
Contributor

mhorst00 commented Apr 4, 2022

@LeonAmtmann and me want to implement a couple of algorithms requested here. Right now we are working on these 3:

  • Gauss-Elimination
  • Newton-Raphson method derivation
  • Basic matrix operations: add, subtract, multiply

All of these should be generic.

@erfan-khadem
Copy link
Contributor

Now that I have added (#309), it should be really easy to implement 2-SAT problem's solution.
Here is my CPP implementation if anyone is interested.

@erfan-khadem
Copy link
Contributor

@siriak, what is your opinion about moving towards creating a general purpose crate for crates.io? We already have the "basic infrastructure" and people can really benefit from these implementations.

@siriak
Copy link
Member

siriak commented Apr 11, 2022

In general, I like the idea, but let's discuss it in more detail on our Discord server https://discord.gg/adJacSyV

@erfan-khadem
Copy link
Contributor

I have an idea for implementing big number support:

First, One can implement a really basic base 10 big number module. It only supports addition and multiplication by 2. It can be formatted as a string and can be created from a string.

After that, a big number module can be implemented that is basically just a BitSet with usual operations (addition, multiplication, division, ...). Converting to and from strings can then be handled using the base 10 implementation.

Right now I am just way too busy, and I will not have time to implement these, plus the second one will have a ton of boring boilerplate. Can someone implement (or even just partially implement) any of the above modules?

Also, there might be simpler approaches to this problem, so other suggestions are welcome.

@kou-sia
Copy link
Contributor

kou-sia commented Sep 10, 2022

@siriak
I want to run_length_encoding.
This is because 'burrows_wheeler_transform' is already implemented and it would be beneficial to add 'run_length_encoding' (PR369) to the library, which is often performed following this algorithm.

@kou-sia
Copy link
Contributor

kou-sia commented Sep 30, 2023

I've implemented it before.
So if you want to add run length, I suggest you revamp the existing source code.
What do you think?

https://github.com/TheAlgorithms/Rust/commits/master/src/string/run_length_encoding.rs

@siriak siriak removed the dont-close label Dec 28, 2023
Copy link

This issue has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jan 28, 2024
Copy link

github-actions bot commented Feb 5, 2024

Please ping one of the maintainers once you add more information and updates here. If this is not the case and you need some help, feel free to ask for help in our Gitter channel. Thank you for your contributions!

@github-actions github-actions bot closed this as completed Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale
Projects
None yet
Development

No branches or pull requests