6 ms·
Show HN: I started a repo for sharing algorithm implementations
Everything that would be here is in the README. I hope this gets big, it has tons of potential.
- brudgers 13y agoRosettaCode is a site that might be of interest. http://rosettacode.org/wiki/Rosetta_Code http://rosettacode.org/wiki/Rosetta_Code
- kennyledet 13y agoYes, that's actually one of the sites that led to this idea, which in my mind is superior in many cases. For instance (and probably the only instance that matters), we get to leverage the power of Git and Github over just wiki-based editing Also, I think the organizational style on Github is more suitable for what this has the potential to be. I would love if I could clone the code on RosettaCode to my machine, add things, and send the change requests right back from the power of the command line. We're both programmers, so of course we know it's doable with code. And I could go ahead and code that script. However, it's not really practical. Thanks though, you just gave me a new idea for a command line utility (not just limited to Rosettacode's wiki) P.S., I will add a link to it in the README.
- X4 13y agoThat can be done and should be done. In IRC #rosettacode on freenode and ask if someone of the admins will add: http://www.mediawiki.org/wiki/Template:WikimediaGitCheckout http://www.mediawiki.org/wiki/Template:WikimediaGitCheckout or if you can contribute something to their wiki's sourcecode. It IS GPL, so you will be able to retrieve the code! :)
- brudgers 13y agoThe shortcomings you mention with Rosetta Code living in Wiki format are some of the same motivations for Ward Cunningham's new federated wiki project. See: https://github.com/WardCunningham/smallest-federated-wiki https://github.com/WardCunningham/smallest-federated-wiki
- elwell 13y agoI'm sure there is a resource somewhere that can be used to jump-start this repo with a bunch of implementations.
- kennyledet 13y agoOf course, but the purpose of this repository was to keep it to the implementations of active participants in the repo.
- goldenkey 13y agoWhy post this when you only have a single insertion sort in C? Practically, this has zero use compared to books which include algorithms, illustrations, and code.
- regularfry 13y agoRelease early, release often?
- highCs 13y agoI would suggest to not put the algorithm into a main function as it is done in your sort but instead in a separate one with a proper signature.
- Hernanpm 13y agoI suggest you participate in online programming competitions. For me it was more helpful than just read books.
- tbirdz 13y agoI agree with this very much. Check out http://uva.onlinejudge.org http://uva.onlinejudge.org for some example problems with automatic judging of contest problems.
- kennyledet 13y agoI had discovered this link a few days ago. Added it to the resources section
- kennyledet 13y agoI don't see where you think I just read books, lol, but thanks for the suggestion man. I have been planning to join a few competitions, and definitely some hackathons in 2014.
- yeukhon 13y agoThere is a handful of websites showing algorithm implementations and they are on edu sites. Unless you plan to write the algorithm in multiple popular algorithms...
- rodrodrod 13y agoHave you considered contributing to LiteratePrograms[0] (or such) instead? This is great practice, and I encourage you to go for it, but for those interested in looking at algorithms implementations, or looking to cut their teeth and contribute implementations, I'd encourage you to look at already existing algorithm repositories. [0]http://en.literateprograms.org/LiteratePrograms:Welcome http://en.literateprograms.org/LiteratePrograms:Welcome
- kennyledet 13y agoAgain, the purpose of this is to not use wiki-based collaboration but leverage the power of Git and Github. >instead Look guys, this is not trying to replace anything. It's something new. It should be supplemental to one's journey, I'm not trying to pass this off as some attempt to be even the main resource for learning algorithms. That would be foolish. >This wheel was invented, but it's better for traction in the snow We really need to stop holding ourselves back so much in this field, it's not really proper for us. Thanks for the link though, it will be added.
- gametheoretic 13y agoWhether you recognize it or not, you face a choice between: a) keeping your name on said repo, and b) substantially higher growth rate. When people do things for free, they don't do it so someone else can put their name on it. (It's irrelevant whether this was your "intention" -- I'm not saying, I'm just saying.)
- goldenkey 13y agoWell he also puts his name in the insertion sort file at the top named, wait for it.. "kennyledet_insertion_sort.c": // Kendrick Ledet 2013 As if git blame wasn't enough, let's stick our full names in every file prefixed with our name. People have got to know that I'm the one who created this sample algo code!! <waits for applause>
- kennyledet 13y ago> let's stick our full names in every file prefixed with our name. People have got to know that I'm the one who created this sample algo code!! I'm not exactly sure what you're getting at here, or why you're trying to be funny in what I wanted to be a relatively serious affair. The implementation as well as the comment were both written way before I even had the idea for this repository. Also, 1. Kennyledet just so happens to be my Github name. The full name comment at the top is not a listed convention. 2. The convention of putting your github username is actually a feature. Do you suggest just clumping everything together under one algo folder, where filenames could be similar and possibly conflict? :) Again, it's not about people discovering me, it's about making this popular on Github so more practicing programmers can share, discuss and learn new algorithms. Please think more logically here.. P.S., I know what git blame is. Don't try to undermine the point here. I wanted the file structure to be flat and adhere to those conventions for more reasons than you probably think I have. You're welcome to start your own repo and try and get it as active as this one has within 2 hours...Then I'll close mine. Thanks.
- goldenkey 13y agoI'm gonna get on that repo, because that's what my criticism infers, creating my own repo. Yes.
- cmpitg 13y agoHow do you make sure the correctness of the implementations? Shouldn't there be tests?
- goldenkey 13y agoThe code is the test. If the code runs without compilation errors, then use it for healthcare.gov </sarcasm>
- kennyledet 13y agoYou forgot to open the the sarcasm tag :)
- goldenkey 13y agoThat's part of the hidden DOM. Implicit. ;-)
- kennyledet 13y agoSorry, but explicit > implicit for markup. Btw, how's that repo going? :)
- goldenkey 13y agoSorry, haven't started it yet ;-)
- kennyledet 13y agoPrecisely. This is something that I have plans on implementing, but obviously I don't have the whole day 24/7 to manage this repo man. I'm doing other things right now (work), that's why I took so long to even answer the initial comments in this thread.
- ericHosick 13y agoTests and behavior should be defined before the code. I recommend you comment out all code, write the tests and then un-comment the code line by line. This not only tests the code, but tests the tests and assures that you are covering the edge cases the code contains already.
- IgorPartola 13y agoI like this idea. Here's how I'd expand it if I had 100 hours to kill: - Rename the repo to be shared and add yourself as a contributor, instead of branding it as yourself. - Organize the files by src/ALGO/LANG/author-name.EXT. That way the emphasis is on the algorithm, then the language. I don't care much about who implemented it, other than to differentiate it from others' implementations for quality, etc. - Provide a common-ish API. You don't want to stick your entire algorithm into main(), that's not useful. You want a nice clean interface, so that the consumers of this repo can copy-paste these clean implementations into their own code. Maybe remove main() entirely, and stick it into src/ALGO/LANG/main.EXT. That way I can consume an entire file from your repo without modifying it. - Provide unit tests. If you separate out main(), you could do stick all the tests into src/ALGO/LANG/tests.EXT. The value of this type of repo would be that I can grab a clean, well tested copy of -sort and use it directly. - Edit: Change from underscores to dashes in filenames. Underscores are for losers :). Use dashes whenever you can. - Add lots more algorithms, not just basic ones. - Get a few friends to add some algorithms, then thoroughly review them in comments on GitHub. - Provide speed test comparisons of each implementation, stick them in src/ALGO/LANG/speed-tests.EXT - Now that we are getting fancy with the testing, etc., provide a Makefile or some such for building the various test programs and running unit and speed tests on them. - Edit: Stub out lots of potential algorithms. Even if you don't know how to implement them, create the directory and main.EXT for them, then open a ticket so that others can implement them. Give everyone that submits a pull request committer access, so they might work directly on this repo and not deal with any friction by having to wait for you. There is probably more, but the above would eat nicely into that first 100 hours. I have no idea what you'd personally get out of this on the other end. Probably nothing. On the other hand, this could become the repository to check for a weird "2x faster with smaller memory usage" implementation of a red-black tree, or a clever general number sieve, etc.
- DallaRosa 13y agoCheck my repo out :) https://github.com/learnalgorithms/datastructures https://github.com/learnalgorithms/datastructures
- IgorPartola 13y ago
- DallaRosa 13y agoI've started the same thing before. Right now I have algorithms implemented in Go, Java and C/C++ https://github.com/learnalgorithms/datastructures https://github.com/learnalgorithms/datastructures Accepting contributions :)
- krat0sprakhar 13y agoGreat Idea! I have something similar going at - https://github.com/prakhar1989/Algorithms https://github.com/prakhar1989/Algorithms only in Python at the moment. Contributions are more than appreciated! :)
- kennyledet 13y agoNice man. Python is one of my favorite langs, starred and watching.
- wfunction 13y agoWorth taking a look at: http://www.keithschwarz.com/interesting/ http://www.keithschwarz.com/interesting/
- kennyledet 13y agoDude, holy crap. I had this link bookmarked in the past, lost all my bookmarks (yeah, back then I was dumb enough to not back these things up) and never remembered the link. Many thanks.
- tbirdz 13y agoAs far as books go, I am partial to "The Algorithm Design Manual" by Steven Skiena. It has good explanations of how the data structures and algorithms work, as well as entertaining "War Stories" of algorists in action.
- kennyledet 13y agoAh yes, surprised I forgot to include this classic. Adding it in.
- codex 13y agoI use The Stony Brook Algorithm Repository: http://www.cs.sunysb.edu/~algorith/ http://www.cs.sunysb.edu/~algorith/.
- kennyledet 13y agoThis is pretty comprehensive. I linked to it in the resources section
- McUsr 13y agoIt is nice to have a place with algorithms of fairly common interest. There is however a definitive resource on the web: http://calgo.acm.org http://calgo.acm.org