I'm opening this issue just to point you to my PR that fixes it: https://github.com/phishman3579/java-algorithms-implementation/pull/159 - all the details are on the PR description.