From b46c49228497cb440467167bad3123c327bd620f Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Tue, 17 Oct 2017 00:12:32 +0800 Subject: add --- data_structures/chapter_3/polynomial_in_list.c | 36 ++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 data_structures/chapter_3/polynomial_in_list.c (limited to 'data_structures/chapter_3/polynomial_in_list.c') diff --git a/data_structures/chapter_3/polynomial_in_list.c b/data_structures/chapter_3/polynomial_in_list.c new file mode 100644 index 0000000..0ecdf33 --- /dev/null +++ b/data_structures/chapter_3/polynomial_in_list.c @@ -0,0 +1,36 @@ +#include +#include + +typedef struct node* ptr_to_node; + +struct node +{ + int coefficient; + int exponent; + ptr_to_node next; +}; + + +typedef ptr_to_node polynomial; + +void add_polynomial(polynomial poly1, polynomial poly2, + polynomial poly_sum) +{ +} + +void mult_polynomial(polynomial poly1, polynomial poly2, + polynomial poly_prod) +{ +} + +void print_poly(polynomial poly) +{ + polynomial p; + + p = poly->next; + + for(; p != NULL; p = p->next) + printf("%dx^%d + ", p->coefficient, p->exponent); + + printf("\n"); +} -- cgit v1.2.3