linux下面遍历二叉树的方法twalk
void twalk(const void *root, void(*action)(const void *nodep,
const VISIT which,
const int depth));
action是遍历到每个节点要做的工作, 可以在action里面用tdelete删除本节点吗?这样遍历会不
会被打断?
问题点数:20、回复次数:2Top
1 楼gettext(冰雪之崖)回复于 2006-08-03 10:22:44 得分 0
不行。
man twalk
...
You should not modify the tree while traversing it
as the the results would be undefined.
...
Top
2 楼yjf7888(seeking a place 找工作了location:Chengdu)回复于 2006-08-03 10:32:30 得分 0
想想twalk可能的实现代码,就知道不可能支持在action里面删除节点Top




