Exercise: +-1 bug and center of an array problem
  A problem that is constantly cropping up in designing even the simplest algorithm or a program is dealing with +-1 bug when we calculate positions within an array, very noticeably while splitting it in half. This bug is often found in buffer overflow type of bugs. While designing one complicated algorithm, we needed various ways of splitting an array, and we found lack of general guidance for this apparently minor problem. We present an exercise that tracks the cause of the problem and leads to the solution. This problem looks trivial because it seems obvious or insignificant, however treating it without outmost precision can lead to subtle bugs, unbalanced solution, not transparent expressions for various languages. Basically, the exercise is about dealing with <= < as well as n/2, n/2-1, (n+1)/2, n-1 and similar expressions when they are rounded down to the nearest integer and used to define a range. 
Aleksandar Perisic
cs.PL