algorithms example