Dynamic Programming Algorithms for Computing Optimal Knockout Tournaments