(注
#include
#include
void main()
{
int i
int a[
int b[
printf(
for(i=
scanf(
printf(
for(i=
scanf(
for(i=
for(k=
{s=
for(j=
k
if(j>=k)
k
else
continue;
s+=a[k
flag=
}
if(flag)
{
c[count++]=s;
flag=
}
}
for(i=
printf(
}
數據結構練習題
(注
#include
#include
#include
void exit(int);
#define MAX
typedef struct node{
char d;
struct node *lchild
}Tnode;
void MKTree(char pre[]
{
int i;
if(pres>pree||is>ie)
*r=NULL;
else{
*r=malloc(sizeof(Tnode));
for(i=is;i<=ie;i++)
if(pre[pres]==in[i])
{
MKTree(pre
MKTree(pre
break;
}
}
}
void postorder(Tnode *r)
{
if(r)
{
postorder(r
postorder(r
printf(
}
}
int num(Tnode *r)
{
if(r==NULL)
return
else
if(r
return
else
return num(r
}
int height(Tnode *r)
{
int h
if(r==NULL)
return
else
{
h
h
return
}
}
void main()
{
Tnode *r;
char pre[MAX]
printf(
gets(pre);
gets(in);
MKTree(pre
printf(
postorder(r);
printf(
printf(
}
[
From:http://tw.wingwit.com/Article/program/sjjg/201311/23801.html