Sorting, graph traversal, and dynamic programming algorithms