
Fundamental Algorithms III - tu7001
http://lion137.blogspot.com/2019/02/fundamental-algorithms-iii.html
======
atoko
I would appreciate better naming on the variables. Some of this is hard to
read through with single letter names

~~~
derekp7
For me this really depends on the context. For example in a small for loop I
entirely expect to see the variable "i" used (i = "index" or "iterator"). In
three nested loops, I also expect "i", "j", and "k" used for each loop level.
This is mostly because it is common enough convention that I don't have to
think about it. Same reason I would rather see "2 + 3 * 7", vs "two plus three
times seven", the information just gets in my brain faster that way without
filler.

Other cases include the comparison function for a sort algorithm, where I
expect "l" and "r" for left and right, and the sort function itself I expect
to see "a" for array, "c" for comparison function, "s" for swap function.

But when the variables don't really make much sense, or there is no existing
convention, then there should at least be a key present for what each variable
means.

~~~
mtsr
I've always used ii, jj and kk, etc. These are just as easy, but allow
languages/editors without variable renaming to do a useful search/replace on
them, because you just know you will at some point.

~~~
jstimpfle
Most editors have at least regex search / replace. Most regex flavours allow
you to do '\<i\>' or similar to specifiy word boundaries.

------
SiebenHeaven
Are these as performant/optimised in terms of time and space complexity as
they can be?

~~~
tu7001
Thanks, complexity, I'm gonna going through that, and adjust.

