Enumerate Algorithm
枚举算法(enumerate algorithm) 是基于已有指示来猜测答案的算法。根据输入生成一个可能的集合,从中一一尝试,判断题目的条件是否成立。[1]
要点
明确解空间
建立简洁的数学模型。枚举的时候想清楚:
- 可能的情况是什么?
- 要枚举哪些元素?
减少枚举空间
有了初步的模型后,就要思考:
- 枚举的范围是什么?
- 所有的内容都要枚举吗?
选择合适枚举顺序
明确枚举列表后,最后决定合适的枚举顺序。
What is enumeration algorithm?
In computer science, an enumeration algorithm is an algorithm that enumerates the answers to a computational problem. Formally, such an algorithm applies to problems that take an input and produce a list of solutions, similarly to function problems. For each input, the enumeration algorithm must produce the list of all solutions, without duplicates, and then halt.[2]