Solutions for some commons algorithms problems written in Java