Algorithm and Data Structure practice in Java