Polynomial equation representation using linked list

From Static and Dynamic List chapter in PU/ Data Structure and Algorithm

Asked by Alson Garbuja on 19 Aug, 2020

Like 0 Dislike 351 Views

Add a comment

3 Answers

arjun adhikari on 22 Jan, 2021 Like 0 Dislike

We can design a node of a linked list as such:

struct Node{

struct Node * next ;

float coeff ;

int power_of_x ;

int power_of_y ;

int power_of_z ;

}

A single node looks like

   <Coeff>         <power_of_x>         <power_of_y>         <power_of_z>    

And the linked list to represent above given equation can be visualized as:

Add a comment

Anonymous on 21 Aug, 2020 Like 0 Dislike

https://www.cs.colorado.edu/~main/projects/chap05d.html

Add a comment

Anonymous on 21 Aug, 2020 Like 0 Dislike

You can simply make poly node which can represent each term  and can be further processed.

struct poly_node{

int coef;

char base1;

int base1_pow;

char base2;

int pase2_pow;

char base3;

int base3_pow;

struct *poly_node;

};

 

 

Add a comment


Add your answer