Added the 4th algorithm