Migrated most algorithms to use v2 dynamic-programming infrastructure