1
A
回答
1
假設你有這樣一個定義:
template <class T>
class btree_node
{
btree_node **child; // an array of child nodes
T **element; // the elements in this node
unsigned int child_count; // the number of children
// the number of elements is 1 less then child_count
};
然後你需要做這樣的事情:
void btree_inorder(node):
for (int i = 0; i < node.child_count; ++i)
{
btree_inorder(node.child[i]);
handle_element(node.element[i]);
}
btree_inorder(node.child[node.child_count-1]);
相關問題
- 1. 如何遍歷MultiKeyMap?
- 2. 如何遍歷scalaz
- 3. 如何遍歷int [] []?
- 4. 如何遍歷QStringList
- 5. 如何遍歷System.Windows.SystemParameters?
- 6. 如何遍歷priority_queue?
- 7. 遍歷樹遍歷
- 8. 如何遍歷在Python
- 9. ActionScript - 如何遍歷對象?
- 10. 如何遍歷使用thymeleaf
- 11. 如何遍歷集合對
- 12. 如何遍歷字符串
- 13. flash_as3_facebook_api:如何遍歷由FacebookDesktop.login
- 14. 如何遍歷多維NSArray?
- 15. ,如何遍歷對象
- 16. 如何遍歷JSON數組?
- 17. 如何遍歷SQLite行?
- 18. 如何遍歷此IEnumerator
- 19. 如何遍歷ID列表
- 20. 如何遍歷在迅速
- 21. 迭代DFS如何遍歷?
- 22. 如何遍歷在角2
- 23. 如何遍歷像素?
- 24. jQuery如何遍歷DOM?
- 25. 如何遍歷一個pyspark.sql.Column?
- 26. 如何遍歷從在JavaScript
- 27. 如何遍歷char數組
- 28. 如何遍歷一個DataTable
- 29. 如何遍歷DOM對象?
- 30. 如何遞歸遍歷XPath?
我建議讓羅伯特·塞奇威克在C++ *算法的副本:第一部分5 *,或幾乎任何其他經過充分審查的算法文本。 – 2010-05-10 02:07:58
B樹和二叉樹是不同的東西。 – 2010-05-10 02:17:07
Btree和BST不是兩回事嗎? – 2010-05-10 02:17:38