Try to focus your code on to only those things you want reviewed. If you want an algorithm reviewed, thethen try to include only thatthe code that is related to the algorithm. This reduces the amount of 'distraction', and it also means there is less code to read, and criticize. The more code you include in your question, the more opportunity there is for reviewers to find the 'simple' things that are wrong. However, you should try, whenever it is possible, to provide everything required to compile/run your code on its own (sometimes, just a missing import
or include
can be a pain for a reviewer). It is much easier to suggest an enhancement to the code when one can check that everything seems to work fine once the code is changed (for that reason, unit tests and/or examples with expected output are always welcome - also, they help to describe what your code is supposed to do).