Algorithms coded in Java and C++