finished adding pseudocode TP algorithm