diff --git a/_04.树/_a.二叉树顺序结构.c b/_04.树/_a.二叉树顺序结构.c index 5c84cf2..17be40b 100644 --- a/_04.树/_a.二叉树顺序结构.c +++ b/_04.树/_a.二叉树顺序结构.c @@ -2,7 +2,7 @@ * @Author: Xu Bai * @Date: 2019-07-09 22:50:41 * @LastEditors: Xu Bai - * @LastEditTime: 2019-07-11 22:38:19 + * @LastEditTime: 2019-07-11 22:44:11 */ #include "stdlib.h" #include "stdio.h" @@ -125,7 +125,12 @@ Status Root(SqBiTree T, ElemType *e) } /*شeλã㣬 Ľֵ*/ -Status Value(SqBiTree T, Position p, ElemType e) +Status Value(SqBiTree T,Position e){ + return T[(int)powl(2,e.level-1)+e.order-2]; +} + +/*λeĽ㸳ֵvalue */ +Status Assign(SqBiTree T, Position p, ElemType e) { /*㡢תΪ */ int i = (int)powl(2, p.level - 1) + p.order - 2; @@ -141,4 +146,5 @@ Status Value(SqBiTree T, Position p, ElemType e) } T[i] = e; return OK; -} \ No newline at end of file +} +