# CS代考程序代写 3/2/2021 Polynomial Evaluation | Assignment Module 4 | CS 116 Courseware | UW Online

3/2/2021 Polynomial Evaluation | Assignment Module 4 | CS 116 Courseware | UW Online

A new course announcement has been posted. Click here to view the new announcement.

The site will be unavailable Mar 2, 2021 from 6:30 AM ET – 7:00 AM ET (Waterloo time) for scheduled maintenance.
Course  Module 4: Lists  Assignment Modul…  Polynomial Evaluati…
Polynomial Evaluation
An integer polynomial is an expression of the form where is a variable (or indeterminate) and are integers. The expression contains terms separated by a plus sign. The values are called coecients.
In this question, we will represent polynomials using strings formatted exactly like this (terms separated by “+” with exponents strictly decreasing from left to right) except that:
All of the coecients will be non-negative integers without leading zeros.
The variable will always be .
Exponents will be denoted using the carat symbol. For example, will be represented by “11x^6”
The variable and exponent will not appear in a constant term (i.e. ). For example, will be represented by “116”.
https://online.cs.uwaterloo.ca/courses/course-v1:UW+CS116+2021_01/courseware/42d9be21ec8244f5a2a251ea657d69e5/9683588d0b2849079f8bfdb1f7f16768/1?activate_block_id=block-v1%3AUW… 1/5
0x611 0x0c 6×11
ic 1+n 0c,1c,…,1−nc,nc
x 0x0c+ 1x1c+⋯+ 1−nx1−nc+ nxnc
x

3/2/2021 Polynomial Evaluation | Assignment Module 4 | CS 116 Courseware | UW Online
The exponent symbol and exponent (i.e. “^1”) will not appear in a linear term (i.e. ). For example, will be represented by “116x”
Terms with a coecient of zero are not included.
There will be at least one non-zero coecient. (One implication of this is that there is no zero polynomial.)
Any coecients equal to one are not included.
The value of an integer polynomial at is the integer equal to .
Write a function
that consumes poly which is a string representing a polynomial as described above and an integer val. The function must produce the value of poly at val.
Samples:
For this question, you must use recursion and may not use abstract list functions (map or filter).
No submissions found
1 ## A Polynomial is a Str
2 ## Requires:
3 ## It represents an integer polynomial and is
eval_poly(poly, val)
eval_poly(“18921”, 21976) => 18921
eval_poly(“8x”, 5) => 40
eval_poly(“3x^4+x^3+6x+2”, 2) => 70
https://online.cs.uwaterloo.ca/courses/course-v1:UW+CS116+2021_01/courseware/42d9be21ec8244f5a2a251ea657d69e5/9683588d0b2849079f8bfdb1f7f16768/1?activate_block_id=block-v1%3AUW… 2/5
0c+a1c+⋯+ 1−na1−nc+ nanc a
x1c
1×611