简体   繁体   English

动态编程:最优二叉搜索树和霍夫曼

[英]Dynamic Programming:optimal Binary search tree and Huffman

Is it possible to construct an optimal Binary search tree (OBST) via a greedy algorithm instead of with Dynamic Programming (DP) (for example Huffman's algorithm)? 是否可以通过贪婪算法而不是动态规划(DP)(例如霍夫曼算法)来构造最佳二叉搜索树(OBST)? If so why is DP is preferred in the construction of a OBST? 如果是这样,为什么在OBST的构造中首选DP?

There are no efficient greedy algorithms to always construct an optimal binary search tree. 没有有效的贪心算法来始终构造最佳的二叉搜索树。 However there are likely to be heuristics such as greedy algorithms that construct nearly optimal trees, which may be preferable in practice. 但是,可能会有启发式算法(例如贪婪算法)构造几乎最佳的树,这在实践中可能更可取。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM