30 ms·
I looked at a graph algorithm Bellman-Ford under C++ Why is Graph->edge a pointer not a std::vector Why does the Graph constructor not use member initializer
by pasc1878 4y ago
I looked at a graph algorithm Bellman-Ford under C++
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
- xdavidliu 4y agoyeah I agree. I think it's because they pretty much allow contributions of algorithms from various people and the code review standards are not super high. I recall at one point the BFS algorithm in Java actually used an ArrayList (roughly equivalent to std::vector) for the queue, which is silly because popping from the front is O(N), so I had to submit a fix for that: https://github.com/TheAlgorithms/Java/pull/3231 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
- pjmlp 4y agoUnfortunately that is pretty much C++ as it still gets taught in many places.