楼主:
APE36 (PT乡民)
2014-03-20 00:38:33画出产生的AVL树,每棵树各自独立,对原先的树加入/删除资料
40
20 80
10 30 60 90
25 35 50 70
10、90没有子树
问题如下:
(1)加入资料26
(2)加入资料46
(3)删除资料30
我划出结果(1)
40
20 80
10 30 60 90
25 35 50 70
26
(2)
40
20 80
10 30 60 90
25 35 50 70
26 46
(3)
40
20 80
10 26 60 90
25 35 50 70
46
树枝画不出来,希望不会造成看文章的困恼,我尽量凑成对了,希望不会伤眼!!
请益一下,二元搜寻找到最大值,可以使用以下范例去证明之吗。说明根的特性。
int left_child(int index) {return index * 2;}
int right_child(int index) {return index * 2 + 1;}
void binary_tree()
{
int tree[5 + 1];
cout << "根为" << tree[1];
cout << "根的左边小孩是" << tree[left_child(1)];
cout << "根的右边小孩是" << tree[right_child(1)];
}