码迷,mamicode.com
首页 > 其他好文 > 详细

Complete Binary Search Tree

时间:2015-09-16 01:07:56      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:complete binary search tree

技术分享

                     void solve(    int ALeft,    int ARight,    int TRoot )

                     { /* 为 初始调用为 solve(0, N-1, 0) */

                           n = ARight – ALeft + 1;

                           if (n==0) return;

                           L = GetLeftLength(n); /*  计算出n点 个结点的树其左子树有多少个结点 */

                           T[TRoot] = A[ALeft + L];

                           LeftTRoot = TRoot * 2 + 1;

                           RightTRoot = LeftTRoot + 1;

                           solve(ALeft, ALeft+L-1, LeftTRoot);

                           solve(ALeft+L+1, ARight, RightTRoot);

                     }

技术分享

技术分享

Complete Binary Search Tree

标签:complete binary search tree

原文地址:http://zhenzhuangde.blog.51cto.com/10697385/1695103

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!