Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
107k views
in Computer by (69.2k points)

Write an algorithm to add two polynomials using linked list.

1 Answer

+1 vote
by (69.8k points)
selected by
 
Best answer

Algorithm to add two polynomials using linked liLet p and q be the Let p and q be the two polynomials represented by linked lists

1. while p and q are not null, repeat step 2.

2. If powers of the two terms ate equal 

then if the terms do not cancel

then insert the sum of the terms into the sum Polynomial

Advance p 

Advance q

Else if the power of the first polynomial> power of second

Then insert the term from first polynomial into sum polynomial 

Advance p

Else insert the term from second polynomial into sum polynomial

Advance q

3. copy the remaining terms from the non empty polynomial into the sum polynomial. 

The third step of the algorithm is to be processed till the end of the polynomials has not been reached. 

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...