best how algorithms work