pellen吧 关注:13贴子:238
#include<iostream.h>
#define type int typedef struct Node
{ type data;
struct Node *lchild;
struct Node *rchild;}*Bitree ;
Bitree createtree(type node[ ],int n)
{Bitree T;
if(node[n]==0||n>15) return NULL;
else
{T= new Node ;
T->data=node[n];
T->lchild=createtree(node,2*n);
T->rchild=createtree(node,2*n+1);
return T;}
}
type min=32767;
type max=0;
void PreOrder ( Bitree T )
{
if ( T != NULL ) {
if(T->data<min)
min=T->data;
if(T->data>max)
max=T->data;
PreOrder ( T->lchild );
PreOrder ( T->rchild );
}
}
void main()
{Bitree B;
int tree[16];
int i;
for(i=0;i<16;i++)
cin>>tree[i] ;//第一个输入为0
B=createtree(tree,1);
cout<<endl<<endl ;
cout<<"这是前序遍历的序列: " ;
PreOrder(B);/*此处调用上面的先序遍历函数,显示先序序列*/
cout<<"\n";
cout<<"最小值为:"<<min;
cout<<"最大值为:"<<max;
// 补充若干条语句完成算法
cout<<"\n" ;
}


IP属地:湖北1楼2012-11-22 17:09回复
    你确定没错?


    IP属地:湖北2楼2012-11-22 19:32
    回复


      IP属地:湖北4楼2012-11-23 22:40
      收起回复
        水滴


        IP属地:湖北5楼2012-12-09 17:33
        回复
          水滴


          IP属地:湖北6楼2012-12-09 17:33
          回复
            水滴


            IP属地:湖北7楼2012-12-09 17:34
            回复
              水滴


              IP属地:湖北8楼2012-12-09 17:34
              回复
                水滴


                IP属地:湖北9楼2012-12-09 17:34
                回复
                  冒泡、
                  void BubbleSort(sqlist &L)
                  { RcdType w;
                  i=L.length;
                  while(i>1)
                  {lastExchangeIndex=1;
                  for(j=1;j<i;j++)
                  {
                  if(L.r[j+1].key<if(L.r[j].key))
                  {
                  w=L.r[j];
                  L.r[j]=L.r[j+1];
                  L.r[j+1]=w;
                  lastExchangeIndex=j;}
                  }
                  i=lastExchangeIndex;
                  }
                  }


                  IP属地:浙江10楼2012-12-20 17:07
                  回复
                    1


                    IP属地:湖北来自Android客户端11楼2013-01-04 23:27
                    回复
                      1


                      IP属地:湖北来自Android客户端12楼2013-01-04 23:27
                      回复
                        1


                        IP属地:湖北来自Android客户端13楼2013-01-04 23:28
                        回复
                          ggg


                          IP属地:湖北来自手机贴吧14楼2013-01-09 00:16
                          回复
                            1y


                            IP属地:湖北来自手机贴吧15楼2013-01-09 00:17
                            回复
                              1y


                              IP属地:湖北来自手机贴吧16楼2013-01-09 00:17
                              回复