While working on an implementation of merge sort promised in the previous article, I realized that I’d like to use one neat little thing, which is worth its own post. It is a simple strategy for sorting or doing comparison-based tasks, which works wonderfully when input data is small enough. Suppose that we have a very small array and we want to sort it as fast as possible. Indeed, applying some f
![Performance comparison: linear search vs binary search.](https://cdn-ak-scissors.b.st-hatena.com/image/square/eac05e3482b781d9c8e41fbcb99ca147230686b5/height=288;version=1;width=512/https%3A%2F%2Fdirtyhandscoding.wordpress.com%2Fwp-content%2Fuploads%2F2017%2F08%2Fplot_elem_655361.png)