Algorithms with implementations by java