kennyledet / algorithm-implementations Goto Github PK
View Code? Open in Web Editor NEWShare, discuss and learn about algorithm implementations!
Home Page: http://algorithm.zone
License: MIT License
Share, discuss and learn about algorithm implementations!
Home Page: http://algorithm.zone
License: MIT License
Hi all,
As this repository is growing in terms of contents (so much algorithms in here), the problem of finding a needle in this haystack will certainly occur. Maybe this will be addressed in the web app (#114)... But I just feel like we should start thinking about a way of organizing all these algorithms in topics. See this project, for instance.
Cheers,
Roland.
The website seems to have a problem showing the c# algorithms.
If you have a look at http://dry-sea-7022.herokuapp.com/language/12
You will see that bubblesort links to the c version:
https://github.com/kennyledet/Algorithm-Implementations/blob/master/Bubble_Sort/C/mitogh/bubble_sort.c
I think most merges and accepted PRs have wrong commit message, the message with which I'd committed. e92f741 commit is not pushed by me.
I'm not sure what did go wrong while merging.
Please update commits. It seems like recently updated every commit is Bogosort implementation.
I think it would be great if the algorithms are organized inside folders, group by specific topic, as follows.
And so on.
In https://github.com/kennyledet/Algorithm-Implementations/blob/master/Dijkstra%27s_Shortest_Path/Lua/Yonaba/dijkstra.lua lines 84 and 85 seems to be reversed.
if u == target then return backtrace(u) end
if u.distance == math.huge then break end
As it is, you can detect a target arrival through a non-existing link.
Hey there,
I was wondering if you (@kennyledet) had an update for us regarding the
browsable web-interface for the algorithms?
Thanks, Joseph
This is more of a feature request: would it be possible to have a way to see algorithm implementations by language? Perhaps directories of symlinks?
Thank you for the stimulating and inspiring project!
@jcla1 , @patrickyevsukov , @dalleng
Hey, you guys have been extremely helpful and dedicated to the repo! I just want to take the time out from my schedule to thank each one of you. You're hugely contributing factors to why this repo has been successful, in addition to all the algorithm contributors.
Before eventually open-sourcing the web app (still kinda busy with work and iOS app projects, and I want the Flask codebase to be perfectly clean and ready for open source), I plan on adding a new page to it dedicated to the contributors (links to blogs/resumes, etc.).
Is this cool with you all? What would you like to see on this page?
Best regards,
Kendrick L.
I use your code, and this have issues when I run this program
Maximize p = x + y subject to 2x + y <= 4, x + 2y <= 3
I solve it changing findEnteringColumn function
`// finds the next entering column
private int findEnteringColumn(){
//float[] values = new float[cols];
//int location = 0;
int count = 0;
for(int pos = 0; pos < cols-1; pos++){
if(table[rows-1][pos] < 0){
return pos;
//System.out.println("negative value found");
//count++;
}
}
return -1; // This case never exist
/*
if(count > 1){
for(int i = 0; i < cols-1; i++)
values[i] = Math.abs(table[rows-1][i]);
location = findLargestValue(values);
} else location = count - 1;
return location;
*/
}`
To validate I use this web https://www.zweigmedia.com/RealWorld/simplex.html
My complete code is here
`/*
import lp.LPObjects.Simplex.ERROR;
/**
Use this class to test LP programs
@author Miguel Angel Ramos Valdovinos
*/
public class prueba {
public static void main(String[] args) {
float[][] table = new float[3][6];
table[0][0] = 2;
table[0][1] = 1;
table[0][2] = 1;
table[0][3] = 0;
table[0][4] = 0;
table[0][5] = 4;
table[1][0] = 1;
table[1][1] = 2;
table[1][2] = 0;
table[1][3] = 1;
table[1][4] = 0;
table[1][5] = 3;
table[2][0] = -1;
table[2][1] = -1;
table[2][2] = 0;
table[2][3] = 0;
table[2][4] = 1;
table[2][5] = 0;
Simplex solv = new Simplex(2, 5);
solv.fillTable(table);
solv.print();
boolean cont = true;
while (cont){
ERROR res = solv.compute();
if (res == ERROR.IS_OPTIMAL || res == ERROR.UNBOUNDED){
cont = false;
}
solv.print();
}
}
}
`
Hi, i noticed that, in rare cases, jarvis_march
fails to produce a valid hull. Instead, it keeps looping around the supplied point list. I have a really hard time understanding the problem (shouldn't be co-planarity, since it works in other cases). Anyway, i applied a patch that works for me. Not sure a PR is worth it, here my addition (which is admittedly not really mathematic-ish):
local checked = 1
while(visited[q]) do
checked = checked + 1
q = points[q + 1] and q + 1 or 1
if (checked == #points) then
return hull
end
end
.. which goes right at line 40, before the loop. This at least prevents the algo to loop over infinitely, while still supplying a valid hull (at least, it looks to me in a test case with ~ 200 procedurally generated point clouds). I'm bothering to write here because it looks @Yonaba's Lua implementation is the landing page for people with convex-hull needs :)
Hey man, I was looking at your Hamming Code implementation and had one question about it:
How did you determine which variables to use in your loop on line 52?
Thanks in advance.
Best regards,
Kendrick L.
Why are we creating an array of vertices ? i think we can simply have an int to keep track of number of vertices within a NFA. In case im wrong or missing out something, please do let me know.
Link To Code
Hello,
I don't know if it is allowed but I would like to request an algorithm implementation. I've looked at your website http://algorithm.zone but I found no request form or anything like that, so I am posting here.
I'm a Lua coder looking for a pure Lua implementation of the Lempel Ziv Markov chain algorithm, but found none so far (all of them are actually implemented in C, which is useless to me since I am limited to LuaJ).
Would you please be so kind and make one? I would do that myself and make a pull request if I only had the time and especially the skill needed.
Thanks for any reply,
sincerely viluon (Andy)
It'd be better to have generic implementations so these could actually be useable.
Quoting the purpose of this project:
Unfortunately, I haven't really spotted (a popular and language agnostic) one where people used the power of Git to share, discover, discuss and improve algorithm implementations!
The lifo stack at:
https://github.com/kennyledet/Algorithm-Implementations/blob/master/Depth_First_Search/Lua/Yonaba/utils/lifo.lua
Inserts aand removes from the begining of the array. this causes a renumbering of the array after each push or pop.
It is better to store the stack reversed, with the last element at the last position.
Hey guys,
since we are growing well and have many contributors, I think it's time to add a license to the repo that covers all the code in it (unless stated otherwise, maybe we should sort those out).
I would suggest MIT, but it's Kenny's repo, so he gets to decide.
Hey guys, I'm finally done with school and finals for the semester, so I've decided to put up the site for Algorithm Implementations. I've been working on it on and off for a few weeks.
The backend is done in Python/Flask with the front-end framework being Bootstrap 3. I plan to add in AngularJS for some dynamic functionality on the front-end.
It's up on Heroku for the moment:
http://dry-sea-7022.herokuapp.com/algorithms
Please let me know any suggestions/feedback you have so I can add them in before I open source it. Also going to clean the code and templates up.
Thanks,
Kendrick L.
I added unit tests for python implementations of binary search and noticed that @jiang42 and @rohanp implementations do not pass all test cases. I think that both users should submit pull requests fixing the bugs.
How should we handle these cases @kennyledet @patrickyevsukov @jcla1 @Yonaba ? Keep the files and wait till they're fix, removing and waiting for the committer to resubmit?
The C# implementation of Boyer Moore Horspool string searching walks off the end of the array in the case where the needle does not exist in the haystack but all of its component characters do.
Wikipedia provides analize and samples of better gap sequences, than just halving size:
https://en.wikipedia.org/wiki/Shellsort
I was checking there are some people (including me) for some reason sometimes we send in our commit files like: compiled file or some .DS_Store file so I think it's better to add the .gitignore file with some files extension like:
And so on.
Hey guys, just a quick update on the state of the site. School has been pretty busy lately, so I wasn't able to get anything up, but have been working on it.
I'm doing it in Python/Flask and will probably use Bootstrap/Angular for the frontend. I'm not anywhere near as proficient in Angular as I am in Python, or frontend web dev in general, so if anyone would like to help, there should be a repo up within the next week for sure this time.
Hey guys. I started a new internship on Monday! Unfortunately this also means I won't have as much time to commit to updating the web app. So this weekend, I will definitely be open sourcing it here on Github.
Currently the stack is:
Ex. instead of finding the 100 Doors Problem at: http://dry-sea-7022.herokuapp.com/algorithm/1, change to /algorithm/100-doors-problem, then /algorithm/100-doors-problem/java
(for example)
This issue arose when I was deciding whether or not to merge #458 Please see that pull request for context, and Kenny's comments. I am opening an issue here for discussion of this topic.
Looks like all of the 99 bottles problem algorithms (with one exception) lack tests. @kennyledet, @dalleng, @jcla1, @Yonaba should tests ever be optional? If so, I can update the README to reflect that.
Are we still following the described folder structure?
Algorithm_Name/Language_Name/username/filename.extension
Because I don't see that happening anywhere in this project.
One could use the optimization made here at RosettaCode: http://rosettacode.org/wiki/Merge_sort#C.2B.2B
template<typename RandomAccessIterator, typename Order>
void mergesort(RandomAccessIterator first, RandomAccessIterator last, Order order)
{
if (last - first > 1)
{
RandomAccessIterator middle = first + (last - first) / 2;
mergesort(first, middle, order);
mergesort(middle, last, order);
std::inplace_merge(first, middle, last, order);
}
}
template
void mergesort(RandomAccessIterator first, RandomAccessIterator last)
{
mergesort(first, last, std::less<typename std::iterator_traits::value_type>());
}
Much cleaner, and possibly more efficient.
It'd be nice to have a .md for each of the algorithms that gives a brief (like one line) introduction to the kind of problems it solves, and the best and worst case. Of course one can simply hit up wikipedia, but if we're hoping to maximize accessibility, many developers might not realize they're reinventing the wheel. By having a quick note card style reference, it affords for a need-basis learning style.
Hey guys, there was an issue with the Android app not working due to pointing to the wrong Heroku web app URL. It is fixed now!
Best regards,
Kendrick L.
Hey guys, released a native Android app for Algorithm Implementations, called Algorithms.
Here it is: https://play.google.com/store/apps/details?id=com.kennyledet.algorithms.app.grmeb
But as noted in the description, at this point it's pretty much a placeholder and a wrapper around the web app until I have more time to implement a fully native experience. It's still a bit better than viewing in a mobile browser though, and once I implement search on the web app this weekend native search will be in the app too.
As the title says, the comment in the source code clearly says it is not the MSP algorithm, but the KMP string matching algorithm.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.