Algorithms arising from category theory