# Polynomial representation using Linked List for Data Structure in 'C'

**Polynomial representation using Linked List**

The linked list can be used to represent a polynomial of any degree. Simply the information field is changed according to the number of variables used in the polynomial. If a single variable is used in the polynomial the information field of the node contains two parts: one for coefficient of variable and the other for degree of variable. Let us consider an example to represent a polynomial using linked list as follows:

Polynomial: 3x

^{3}-4x

^{2}+2x-9

Linked List:

In the above linked list, the external pointer ‘ROOT’ point to the first node of the linked list. The first node of the linked list contains the information about the variable with the highest degree. The first node points to the next node with next lowest degree of the variable.

Representation of a polynomial using the linked list is beneficial when the operations on the polynomial like addition and subtractions are performed. The resulting polynomial can also be traversed very easily to display the polynomial.

The above two linked lists represent the polynomials,3x

^{3}-4x^{2}+2x-9 and 5x^{3}-2x^{2}+6x+3 respectively. If both the polynomials are added then the resulting linked will be:
The linked list pointer ROOT gives the representation for polynomial, 8x

C Program to read and display a polynomial using linked list .

^{3}-6x^{2}+8x-6.C Program to read and display a polynomial using linked list .

## 0 comments: