Algorithms icon indicating copy to clipboard operation
Algorithms copied to clipboard

python Algorithms

Open bmoussa opened this issue 9 years ago • 19 comments

Hi I want to contribute to this project by adding some python algorithme.This is my first contribution so let me know if I did something wrong!

bmoussa avatar Jan 21 '16 13:01 bmoussa

Hi @bmoussa,

Feel free to send in your contributions to this repo. Do you have something in mind that you want to implement? If you don't have a specific algorithm in mind, you can improve this repo by adding testcases for existing algorithms.

Let me know if you need help with this.

prakhar1989 avatar Jan 21 '16 14:01 prakhar1989

Thank you So for a first contribution I think adding an algorithm in the dp folder. This algorithm that I would call "check.py" will check whether the elements of an array are consecutive.

bmoussa avatar Jan 21 '16 15:01 bmoussa

Hi!! I have some algorithms in mind. can i contribute to this repo?

ab1hi2shek avatar Jan 23 '16 17:01 ab1hi2shek

Sure! Let me know what algorithms do you have in mind and we can move forward from there.

prakhar1989 avatar Jan 24 '16 02:01 prakhar1989

I can write Knuth–Morris–Pratt algorithm(KMP), Merge sort,Tower of Hanoi and Fenwick tree algorithms. what u say?

ab1hi2shek avatar Jan 24 '16 10:01 ab1hi2shek

KMP sounds great. I wanted to add more string algorithms to this repo and KMP sounds like a good way to go. After KMP you can pick up Rabin-Karp and then Boyer-Moore!

Also do remember to add tests as it makes the code more robust.

Looking forward to your PR!

prakhar1989 avatar Jan 24 '16 14:01 prakhar1989

Which of these can I add? Segment tree, strongly connected components (Kosaraju), binary indexed tree and longest common subsequence.

vedangmehta avatar Jan 24 '16 14:01 vedangmehta

@vedangmehta Kosaraju's already there, so is LCS. You can start with Segment Tree.

prakhar1989 avatar Jan 24 '16 14:01 prakhar1989

I can't find LCS in DP section. I can see LIS though.

vedangmehta avatar Jan 24 '16 14:01 vedangmehta

Oh yeah! You're right. Sorry I confused the two. You can go ahead and add that too.

prakhar1989 avatar Jan 24 '16 14:01 prakhar1989

Ok! I'll add both seg tree and LCS.

vedangmehta avatar Jan 24 '16 15:01 vedangmehta

@prakhar1989 , Can i add Edit Distance to DP section??

munendrasn avatar May 23 '16 11:05 munendrasn

@munendrasn: Can you talk a bit more about the algorithm? Probably a wiki link if possible?

prakhar1989 avatar May 23 '16 23:05 prakhar1989

@munendrasn The algorithm is generally known as Levenstein Distance, I believe.

vedangmehta avatar May 23 '16 23:05 vedangmehta

@prakhar1989 , https://en.wikipedia.org/wiki/Levenshtein_distance

munendrasn avatar May 24 '16 03:05 munendrasn

Cool. Sounds good. Do remember to add tests in the PR as well.

prakhar1989 avatar May 24 '16 23:05 prakhar1989

Sure. @prakhar1989 , Also should I close this PR #38 ??

munendrasn avatar May 26 '16 04:05 munendrasn

Can i add modular exponentiation ?

manishrw avatar Oct 13 '16 20:10 manishrw

@prakhar1989 I've sent a PR for modular multiplicative inverse algorithm.

manishrw avatar Oct 15 '16 19:10 manishrw