Answered step by step
Verified Expert Solution
Question
1 Approved Answer
char polynomial1[] = axb+cxd+exf-gxh+jxk; The polyn. is that and i stuck on that part, how i approach that question? Now you need to tokenize each
char polynomial1[] = "axb+cxd+exf-gxh+jxk";
The polyn. is that and i stuck on that part, how i approach that question?
Now you need to tokenize each monomial into its coefficient and its exponent. E.g. 3x5 should be splitted in a stack, you are free to choose your data structure and also the way you store your data. However, I may share my solution idea with you. The node of your data structure can keep a single integer for the coefficient and a pointer to the next node in the structure. You can define a max size for the degree of your polynomial, initialize it with all empty content where each node will refer to an exponent starting from 0 to max degree. Then you can easily insert the coefficients to corresponding nodes. Now your data structures are ready In the second step, you will print the polynomials as shown in Print 2 part. Write a print function for this aim which can take a pointer to the head of your structure. In the third step, you will add your polynomials up, print it in a normal form and also in a simplified form, you will multiply them and print the result (no need to show in a simplified form this time For this aim, you need to write three new functions: add . multiply printSimplify add and multiply functions can get two node pointers to the head of your structures and operate on them Now you need to tokenize each monomial into its coefficient and its exponent. E.g. 3x5 should be splitted in a stack, you are free to choose your data structure and also the way you store your data. However, I may share my solution idea with you. The node of your data structure can keep a single integer for the coefficient and a pointer to the next node in the structure. You can define a max size for the degree of your polynomial, initialize it with all empty content where each node will refer to an exponent starting from 0 to max degree. Then you can easily insert the coefficients to corresponding nodes. Now your data structures are ready In the second step, you will print the polynomials as shown in Print 2 part. Write a print function for this aim which can take a pointer to the head of your structure. In the third step, you will add your polynomials up, print it in a normal form and also in a simplified form, you will multiply them and print the result (no need to show in a simplified form this time For this aim, you need to write three new functions: add . multiply printSimplify add and multiply functions can get two node pointers to the head of your structures and operate on themStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started