Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

When implementing complex algorithm, this kind of code is usually easiest to understand.

When you look at the code, you use the paper that describes the algorithm as documentation. Using same short one letter variable names in the code and paper makes understanding much easier.

The thing I hate most is when the the paper uses 1-based numbering and the programming language uses 0-based numbering. We should settle for 0-based numbering when describing algorithms.



Arithmetic coding often looks just as dense, because C is not a good vehicle to describe algorithms.

Look at eg https://www.cs.ox.ac.uk/jeremy.gibbons/publications/arith.pd... to see a cleaner alternative.

(This is about describing algorithms in papers. Optimizing for performance after the big-O has been taken care of is a different matter.)


Or use 1-based programming languages :) I have implemented several algorithms from papers in Lua and that played in my favor more than once.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: