Skip to content

LPSS Driver Index may be off by 1 #2

Description

@jungph

In the driver program for dynamic_programming/LPSS, there may be an index issue where we should call p.LPSS(0, in.size()); with size-1. The bug isn't detected for LPSS because it returns the correct answer, but is seen when calling LPSS_memo because memo at that index isn't set with constructor, it will always return 0.

int main() {
std::string in = "bbbab";
LPSS_Problem p(in);
auto result = p.LPSS(0, in.size());
Print2dVector(p._memo);
std::cout << "result: " << result << std::endl;
return 0;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions