Algorithms and data structures implemented in many programming languages
the-algorithms.com
the-algorithms.com
fibs = 0 : scanl (+) 1 fibs
It also showcases Haskell's lazy list and recursive definition of data (not your usual recursive function).They both beat naive exponential time algos, of course.
Btw, another less cryptic way to generate the list of Fibonacci numbers is
fibs = f 0 1 where f a b = a : f b (a+b)https://github.com/snippetfinder/The-Quick-Snippet-Reference
Why is Graph->edge a pointer not a std::vector Why does the Graph constructor not use member initializer lists but assignemnt in the constructor body.
So confidence in the quality of the code is not high.
Then I see ``` this->edges = (Edge )malloc(E sizeof(Edge)); ```
This is not C++.
Just stop reading it is not worth it. Find another source
https://github.com/TheAlgorithms/Java/pull/3231
but I agree that basic low-hanging issues like this (and the exponential-time fibonacci that another commenter pointed out) really prevents me from taking this repo very seriously
That is exactly why Val, Carbon and Cppfront aren't copy-paste compatible with C.
Herb Sutter even mentions this at the end of his keynote.
The URLs are pretty shitty: https://the-algorithms.com/algorithm/show-response
What I wanted to link to there was https://github.com/TheAlgorithms/Python/blob/master/audio_fi..., where we see that evidently doing an FFT in Python requires... matplotlib?
And in https://github.com/TheAlgorithms/Python/blob/master/backtrac... we see a graph-coloring algorithm statically typed to use (lists of) the built-in lists, so you can't store your graphs in a Numpy matrix or a sparse matrix.
On the other hand, the doc strings are great, and seem to include doctests for just about everything.
So I suspect that this is not going to be a very useful repository for reusable code, but it should be wonderful as a learning resource.
> Implementations are for learning purposes only. As they may be less efficient than the implementations in the Python standard library, use them at your discretion.
So maybe I should have called it "the Expat license".
Have you thought about doing some kind of CI/CD to test that each new version responds with the same results as all the others?
Example: https://www.nist.gov/itl/sed/products-services/statistical-r...
(Some really bad implementations don't even store the old balance factor in the node and call a recursive height function to figure it out beforehand as well, I just skimmed the implementations I looked at so I didn't check to see if they were doing that as well)
If you have all the temporary ingredients of the data, you could work out when height(left) height(right) needs to be evaluated.
If I get some free time I may see if I can contribute some code.
And today I learned its main web server library Hunchentoot has a huge unpatched security bug? https://news.ycombinator.com/item?id=32950465
https://docs.python.org/3/library/collections.html#collectio...
I'm quite tickled by the idea that you need a linked list because your allocator is spending too much time - traversing a linked list.
I was just surprised as I thought it was a basic structure, so it just seemed like there ought to be a `from collections import linkedlist` because python just feel like the kind of language where you just do that without even consulting the docs.
Python doesn't want you thinking in terms of data structures, just in terms of functionality. Which I think is unfortunate and limiting.
[1]: https://github.com/python/cpython/blob/a4ac14faa5c2be433738d...
But in real life the extra cost of allocating a node is way higher than simply copying over a block of memory, for most realistic sized workloads, which are small.