0

In Cormen's Algorithms book, it gave an algorithms for finding the longest subsequene. When filling the table, it started from the lower right corner instead of the upper left corner: In short, it looked for the longest subsequence of two sequences starting from the last elements of both sequence instead of the first elements. Is there a brilliant reason behind this (more efficient,etc.)?

Guppy_00
  • 165
  • 1
  • 1
  • 8
  • I think there is no such a special reason for designing an algorithm like that. But if you keep learning dp and algorithm, you will find it's very natural to solve that problem in that way. – Sayakiss Mar 29 '16 at 01:57
  • As @Sayakiss said, it is the natural DP thing to do. But you can easily see that there is no functional, algorithmic difference between a string read right-to-left or left-to-right. – Kittsil Oct 20 '16 at 20:34

0 Answers0