赞
踩
1.num[10] = { 1,2,3,4,5,6,7,8,9,10 },排列成二叉树
2.父节点的位置为pos,左孩子的位置为2pos,右孩子的位置为2pos+1
3.那么递归结束条件为位置大于10时,
4.模拟几次递归,先序
#include<stdio.h> #include<stdlib.h> typedef struct Treenode { struct Treenode* left; struct Treenode* right; int value; }treenode; void init(treenode** tree, int* num, int size, int pos); void display(treenode* tree); void main() { int num[10] = { 1,2,3,4,5,6,7,8,
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。