How to enumerate all possibilities for brute-force algorithm? -
this question may not specified, think important. when want solve optimization problem , not familiar dynamic programming
method, first idea comes mind.
i can give simple examples:
- get min element of list (very simple)
- list permutation of set
- list subset of set
these problem have mature method. there problem not clear:
- list
edit distance
of 2 string (i mean not shortest 1 of edit operation) - list
common subsequence
of 2 sequence - list possibilities of parenthesizing
matrix chain multiplication
i have no idea solving these problems brute-force method. question is:
is there systematic generic method list possibilities brute-force algorithm?
backtracking 1 of general methods finding solutions problem. per wikipedia,
backtracking general algorithm finding (or some) solutions computational problem, incrementally builds candidates solutions, , abandons each partial candidate c ("backtracks") determines c cannot possibly completed valid solution.
the classic textbook example of use of backtracking 8 queens puzzle, asks arrangements of 8 chess queens on standard chessboard no queen attacks other.
two of problems mention,
• list common subsequence of 2 sequence
• list possibilities of parenthesizing matrix chain multiplication
can handled using backtracking. not sure edit-distance question.
Comments
Post a Comment