We can compare the two algorithms here. The second algorithm gives the same plot but the first one changes.