#include<stdio.h>#include<conio.h>#include<math.h>#define OVERFLOW -2#define OK 1typedef struct LNode{ float coef; int expn; struct LNode *next;}LNode,*Linklist;int initlist(LNode *L){ L=(LNode *)malloc(sizeof(LNode)); if(!L)exit(OVERFLOW); L->next=NULL; return OK;}int Creat...
#include<stdio.h>#define n 5int huan(int *a){ int i,j,t,m; i=0; j=n-1; t=a[0]; while(i<j) { while(i<j&&a[j]>0) j--; if(i<j) a[i++]=a[j]; while(i<j&&a[i]<0) i++; if(i<j) a[j--]=a[i]; } a[i]=t; for(m=0;m<...
#include<stdio.h>#include<stdlib.h>int leafcount=0;typedef struct BiTNode{ char data; struct BiTNode *lchild,*rchild;}BiTNode,*BiTree;int CreateBiTree(BiTree *T)/*根据先序序列建立二叉树的二叉链表*/{ char ch; scanf("%c",&ch); if(ch=='-') { *T=NULL; } else{ if(!(*T=(Bi...
#include<stdio.h>#include<conio.h>#include<math.h>#define OVERFLOW -2#define OK 1typedef struct LNode{ float coef; int expn; struct LNode *next;}LNode,*Linklist;int initlist(LNode *L){ L=(LNode *)malloc(sizeof(LNode)); if(!L)exit(OVERFLOW); L->next=NULL; return OK;}int Creatl...
#include<stdio.h>typedef char Datatype;typedef struct BiTNode { Datatype data; struct BiTNode *lchild, *rchild;} BiTNode, *BiTree;void CreateBiTree(BiTree *T) { char ch; scanf("%c",&ch); if(ch=='#') (*T)=NULL; else { (*T)=(BiTree)malloc(sizeof(BiTNod...
#include<stdio.h>#include<conio.h>#define OVERFLOW -2#define OK 1typedef struct LNode{ int data; struct LNode *next;}LNode,*Linklist;int initlist(LNode *L){ L=(LNode *)malloc(sizeof(LNode)); if(!L)exit(OVERFLOW); L->next=NULL; return OK;}void Creatlist(LNode *L ,int n){ LNode *p,*...
#include<stdio.h>#include<stdlib.h>#define n 10void rsh(int *a,int k) { int i,j,l,p,temp; for(i=1;i<=k;i++) if(n%i==0&&k%i==0) p=i; for(i=0;i<p;i++) { j=i; l=(i+n-k)%n; temp=a[i]; while(l!=i) { a[...
#include<stdio.h>#define STACK_INIT_SIZE 100#define STACKINCREMENT 10#define OVERFLOW -2#define OK 1#define TURE 1#define Error 0typedef struct{ int *top; int *base; int stacksize;}Sqstack;void initstack(Sqstack *S){ S->base=(int)malloc(STACK_INIT_SIZE*sizeof (int)); if(!S->base)exit...