BRIDGE COURSE
SubmittedPROJECT
for partial fulfillment of award of
BACHELOR OF TECHNOLOGY
In
Computer science & engineering
By
KALPANA(1751110047) ALISHA SAIFI(1751110014) ASHWANI RAWAT(1751110025)
(GROUP NO. 6) ( SECTION: A )
SESSION 2018-19
G.L BAJAJ GROUP OF INSTITUITIONS, MATHURA
(affiliated to AKTU, Lucknow)
OCTOBER, 2018
CONTENTS
STATEMENT OF PROBLEM
DESCRIPTION OF MODULES
ALGORITHM
FLOWCHART
PROGRAM
APPLICATIONS OF PROGRAM
STATEMENT OF PROBLEM ?
QUESTION:
WRITE A PROGRAM TO
ADD TWO POLYNOMIALS
IMPLEMENTING THEM
THROUGH LINKED LIST.
DESCRIPTION OF MODULES
• Create(void): This will take input(coefficient and
power) from the user and create the polynomial
list and return the starting address of the list.
• Print(struct poly*): This will print the
polynomial equation using ^ sign for power for
example ‘x to the power 3’ will be printed as ‘x^3’.
• Sum(struct poly* a, struct poly*b): this will
add a & b and return the base address of the
resulting polynomial.
ALGORITHM
Poly_add(P,Q) While(temp!=NULL)
{ S=(pnode*)malloc(sizeof(pnode))
temp=P, ptr=Q S->coeff=temp->coeff
While(temp!=NULL && ptr!=NULL) S->expo=temp->expo
{ A->next=S
S=(pnode*)malloc(sizeof(pnode)) A=S
if(temp->expo==ptr=exponent) temp=temp->next
S->coeff=temp->coeff->ptr->coeff While(ptr!=NULL)
S->expo=temp->expo S=(pnode*)malloc(sizeof(pnode))
Temp=temp->next S->coeff=ptr->coeff
Ptr=ptr->next S->expo=ptr->expo
else A->next=S
if(temp->expo>ptr->expo) A=S
S->coeff=temp->coeff Ptr=ptr->next
S->expo=temp->expo A->next =NULL
temp=temp->next }
else
S->coeff=ptr->coeff
S->expo=ptr->expo
ptr=ptr->next
If(R==NULL)
R=S
A=S
Else
A->next=S
A=S
}