Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Here is all the file i got https://drive.google.com/file/d/1FjIjUJu5mYWjHC9UCr10lnDffqb12A1I/view?usp=sharing The only data member should be a std::list named terms. - There is no longer a constructor

image text in transcribed

Here is all the file i got

https://drive.google.com/file/d/1FjIjUJu5mYWjHC9UCr10lnDffqb12A1I/view?usp=sharing

The only data member should be a std::list named terms.

- There is no longer a constructor that takes arrays of integers and the array length.

- A constructor permits polynomials to be constructed from an initializer list of integers.

- A constructor permits polynomials to be constructed from a pair of iterators denoting a range of integer values in some arbitrary container.

- In addition, the Polynomial class must now provide an iterator (and const iterator) allowign access to its terms.

-The iterator should visit terms in ascending order of power.

-The list of terms must be sparse, no terms with zero coefficients are visited.

-One exception: if the entire polynomial is zero, then it shows a single term Term(0,0) of zero coefficient and power.

This assignment builds upon the previous one and produces the same program and similar unit tests One of the common uses of linked lists is to provide sparse storage. For example, if I asked you to represent an NxM matrix of real numbers, you would probably think first of a monolithic block of memory like this 0 2.0 0 1.00 00 00. 0 0 0 00 00 2 4 100000 0o 000 0 Later, you would probably learn that in C++, it's more common to treat this as an array of arrays, leading to something more along the lines shown to the left. To retrieve a[i][j], we first select the (pointer to) row i, then index to the jth column in that i th array 0 0 0002 100000 0 2.0 2 1.0 But in many applications where N and M are particularly large, the vast majority of the elements are zero. In those cases linked lists can be used to represent a row of the matrix. The nodes in the list indicate both a non-zero data value and the column in which that value belongs. Zero data values are simply not stored 7 2.5 To retrieve a[i]Ij], we first select the (pointer to) row i, then search forward through the list for a node labelled with column j. If we find it, we use the data value in that node. If we don't find it, we conclude that a[i] [j] 1s zero 100000 89 0.2 You may have noticed that the Chebyshev polynomials are also fairly sparse, with half the terms having zero coefficients. Other polynomial applications may use an even percentage of non-zero terms In this assignment, you will implement a similar sparse structure (essentially one "row" of the sparse matrix show above) while working with std:lists and providing iterators to your data collection. For example, the polynomial p(x) represented as shown here 1 2x25 + 4x50 will be terms 50-4 This assignment builds upon the previous one and produces the same program and similar unit tests One of the common uses of linked lists is to provide sparse storage. For example, if I asked you to represent an NxM matrix of real numbers, you would probably think first of a monolithic block of memory like this 0 2.0 0 1.00 00 00. 0 0 0 00 00 2 4 100000 0o 000 0 Later, you would probably learn that in C++, it's more common to treat this as an array of arrays, leading to something more along the lines shown to the left. To retrieve a[i][j], we first select the (pointer to) row i, then index to the jth column in that i th array 0 0 0002 100000 0 2.0 2 1.0 But in many applications where N and M are particularly large, the vast majority of the elements are zero. In those cases linked lists can be used to represent a row of the matrix. The nodes in the list indicate both a non-zero data value and the column in which that value belongs. Zero data values are simply not stored 7 2.5 To retrieve a[i]Ij], we first select the (pointer to) row i, then search forward through the list for a node labelled with column j. If we find it, we use the data value in that node. If we don't find it, we conclude that a[i] [j] 1s zero 100000 89 0.2 You may have noticed that the Chebyshev polynomials are also fairly sparse, with half the terms having zero coefficients. Other polynomial applications may use an even percentage of non-zero terms In this assignment, you will implement a similar sparse structure (essentially one "row" of the sparse matrix show above) while working with std:lists and providing iterators to your data collection. For example, the polynomial p(x) represented as shown here 1 2x25 + 4x50 will be terms 50-4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

More Books

Students also viewed these Databases questions