Cycle algorithms