#include
int main()
{
int a[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
int xiajie = 0,shangjie= 9;
int zhongjianzhi= 0;
int k= 0;
printf("%d\n", k);
while (xiajie<= shangjie)
{
mid = (xiajie+ shangjie) / 2;
if (x { shangje = zhongjianz; } else if (k >zhongjianzhi) { xiajie= zhongjianzhi+1; } else { printf("找到%d了\n", k); break; } } } 遍历 #include #include typedef struct Tree{ int data; struct Tree *lchild; struct Tree *rchild; // }Tree,*BitTree; BitTree CreateLink() { int data; int temp; BitTree T; scanf("%d",&data); temp=getchar(); if(data == -1){ return NULL; }else{ T = (BitTree)malloc(sizeof(Tree)); T->data = data; printf("请输入%d的左子树: ",data); T->lchild = CreateLink(); printf("请输入%d的右子树: ",data); T->rchild = CreateLink(); return T; } } void ShowXianXu(BitTree T) { if(T==NULL) { return; } printf("%d ",T->data); ShowXianXu(T->lchild); ShowXianXu(T->rchild); } void ShowZhongXu(BitTree T) { if(T==NULL) { return; } ShowZhongXu(T->lchild); printf("%d ",T->data); ShowZhongXu(T->rchild); } void ShowHouXu(BitTree T) { if(T==NULL) { return; } ShowHouXu(T->lchild); ShowHouXu(T->rchild); printf("%d ",T->data); } int main() { BitTree S; printf("请输入第一个节点的数据:\\n"); S = CreateLink(); printf("先序遍历结果: \\n"); ShowXianXu(S); printf("\\n中序遍历结果: \\n"); ShowZhongXu(S); printf("\\n后序遍历结果: \\n"); ShowHouXu(S); return 0; } 你是否还在寻找稳定的海外服务器提供商?创新互联www.cdcxhl.cn海外机房具备T级流量清洗系统配攻击溯源,准确流量调度确保服务器高可用性,企业级服务器适合批量采购,新人活动首月15元起,快前往官网查看详情吧
网站题目:折半查找和遍历-创新互联
网页地址:http://jkwzsj.com/article/phdoe.html