POLYNOMIAL ADDITION USING LINKED LIST.pptx

863 views 9 slides Jul 16, 2023
Slide 1
Slide 1 of 9
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9

About This Presentation

KKG


Slide Content

POLYNOMIAL ADDITION USING LINKED LIST

Polynomial:  It is a mathematical expression consisting of one or more terms . Ex: 3x^2 - 16y, 4x^3 + 2x - 1 Linked list:  It is a linear data structure that consists of connected nodes. Each node is used to store the data and also the address of next node.           Ex: INTRODUCTION

Let’s say we have two polynomials 3x^2 + 29x + 1……….(i) 5x^2 - x + 2………...(ii) Addition of two polynomials involves combining like terms present in the two polynomials (adding terms of same variable and same exponents).

Adding equation (i) & (ii) 3x^2 + 2x + 1 3x^2 & 5x^2 are 5x^2 – x + 2 like terms. Similarly, x & 2x 8x^2 + x + 3 are like terms. Addition of two polynomials become easier if terms are arranged in descending order.

PROCEDURE FOR ADDING TWO POLYNOMIALS We have two polynomials to add. 5x^6 + 6x^4 + 2x^3 8x^6 + 3x^2 + 4x + 5 Let’s represent above polynomials using linked list.

Adding two polynomials means adding their like terms. So, now we will compare their exponents. 5x^6 + 6x^4 + 2x^3 (Polynomial 1) 8x^6 + 3x^2 + 4x + 5 (Polynomial 2) 13x^6 + 6x^4 + 2x^3 + 3x^2 + 4x +5

In a linked list representation the addition operation is easier to perform because the two polynomials represented by linked list are arranged in descending order.

ADVANTAGES OF USING LINKED LIST: It saves lot of space. There is no need to allocate list size. DISADVANTAGES OF USING LINKED LIST: Cannot go backwards through the list. Cannot jump to the beginning of the list from the end.

THANK YOU
Tags