Classical algorithm implementation in C/C++.