created first three algorithms