Demonstration of polynomial using linked list, Data Structure & Algorithms

Assignment Help:

Demonstration of Polynomial using Linked List

# include

# include

Struct link

{

Char sign; intcoef; int expo;

struct link *next;

};

Typedefstruct link poly; void insertion (poly *); void create_poly (poly *); void display (poly *);

/* Function create a ploynomial list */

voidcreate_poly (poly *start)

{

charch;

staticinti;

printf("\n Input choice n for break: ");

ch = getchar ();

if (ch != 'n')

{

print f("\n Input the sign: %d: ", i+1);

scanf("%c", &start->sign);

printf("\n Input the coefficient value: %d: ", i+1);

scanf("%d", &start->coef);

printf("\n Input the exponent value: %d: ", i+1);

scanf("%d", &start->expo);

}

else

flush(stdin);

i++;

start->next = (poly *) malloc(size of(poly));

create_poly(start->next);

start->next=NULL;

}

/* Display the polynomial */

void display(poly *start)

{

If(start->next != NULL)

{

Printf(" %c", start->sign);

printf(" %d", start->coef);

printf("X^%d", start->expo);

display(start->next);

}

}

/* counting the number of nodes */

Int count poly(poly *start)

{

Lists

If(start->next == NULL)

return 0;

else

}

Return(1+count_poly(start->next));

/* Function main */

void main()

{           poly *head = (poly *) malloc(sizeof(poly));

Create poly(head);

Printf("\n Total nodes = %d \n", count poly(head));

Display (head) ;}

Program: Representation of Polynomial using Linked list


Related Discussions:- Demonstration of polynomial using linked list

What is Oscillating Sort?, For the Oscillating sort to be applied, it is ne...

For the Oscillating sort to be applied, it is necessary for the tapes to be readable in both directions and able to be quickly reversed. The oscillating sort is superior to the po

Dqueue, algorithm of output restricted queue.

algorithm of output restricted queue.

R. Studio, I need a person who has a good background in using R. Studio? I...

I need a person who has a good background in using R. Studio? In adition, a person who is good in using algorithms.

Pseudocodes, how to draw a 5 inch square on the screen using * symbol

how to draw a 5 inch square on the screen using * symbol

Dqueue, how can i delete from deque while deletion is restricted from one e...

how can i delete from deque while deletion is restricted from one end

Fifo, give any example of page replacement using fifo and use your own refe...

give any example of page replacement using fifo and use your own reference string

Random searching, write a program that find,search&replace a text string

write a program that find,search&replace a text string

Draw trace table and determine output of number, Draw trace table and deter...

Draw trace table and determine output from the following flowchart using following data: Number = 45, -2, 20.5

Numerical - algorithm, Q. What is the smallest value of n such that an algo...

Q. What is the smallest value of n such that an algorithm whose running time is 100n2 runs faster than an algorithm whose running time is 2n on the same machine.    A n

Algorithams example, any simple algoritham questions with answers

any simple algoritham questions with answers

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd