Algorithm is correctly implemented.