Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
When you're reading up GfG you really only care about having an illustrative example of the thing. Code standards, reliability etc. don't matter at all.
I suspect the fragility is because it was written to solve some competitive programming question and they tell you exactly what kind of input you get - if the input makes it clear that you'll never get a 2 then there's no point programming that case in (bacause time), for example, even though "properly" the algorithm should handle that case. -
@AlgoRythm to be fair you can use whatever case you want. It still compiles and runs. And if it's consistent across the code - it even looks OK.
It might look unusual to an eye of someone who's been complying to one set of standards [snake_case]. But it works and as long as it's consistent - it's their adopted code style -
@netikras it can't be consistent unless you're only using your code and rewriting the standard libraries.
Fuck people like this who go against the standard language style. -
Their array size is "limit", but they use indices up to and including "limit", so the array should be dimensioned as "limit+1". Noob error.
Another GeeksForGeeks rant
Wisecrack got me a bit interested in primes (just a passing interest). I looked up their python implementation of "Sieve of Atkin". Wow, is it bad.
First of all, they use PascalCase instead of underscore_natation so that's points off right there.
Their function takes a limit as a parameter (pretty obviously).
Their program breaks if you pass a prime number as a limit. That's right, if you give it a 2, it breaks. Pretty pathetic.
Reading the comments, their Java implementation is wrong too.
For fucks sake guys, if you're going to have an algorithm blog at least write good algorithms.
rant