【发布时间】:2015-08-21 12:55:39
【问题描述】:
我在二叉搜索树的中序遍历中搜索数据的位置(索引号)。
void inorder(struct node *root) {
if(!root)
return NULL;
inorder(root->left);
cout<<root->data;
inorder(root->right);
}
如何修改此函数以获取给定数字的位置。
【问题讨论】:
-
首先,请根据stackoverflow的政策格式化代码。
标签: algorithm data-structures tree binary-search-tree inorder