#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define LEN sizeof(Poly)
typedef struct term{
float coef;
int expn;
struct term *next;
}Poly,*Link;
int LocateElem(Link p, Link s, Link &q);
void CreatePolyn(Link &p,int m);
void PrintPolyn(Link p);
int cmp(Link a, Link b);
Link Reverse(Link p);
Link MultiplyPolyn(Link A,Link B);
void Calculate(Link p,float x);
int LocateElem(Link p, Link s, Link &q){
Link p1 = p->next;
Link p2 = p;
while(p1){
if(s->expn > p1->expn){
p1 = p1->next;
p2 = p2->next;
}else if(s->expn == p1->expn){
q = p1;
return 1;
}
else{
q = p2;
return 0;
}
}
数据结构——多项式相乘
最新推荐文章于 2023-04-16 16:32:42 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)