Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在研究一个涉及表达式树的遗传编程问题。我使用的树数据结构仅在深度优先和广度优先遍历方面提供访问器。我只使用这些提供的方法从树中恢复表达式的有效方法是什么?
Ok, problem solved by using a recursive BFS search. Basically the function calls itself on the subtrees unless the subtree is a terminal node, in which case the value of the node is returned.