Sunteți pe pagina 1din 2

1

Data Structures through C

G V V Sharma

Problem 1. Consider the polynomials

p(x) = x + 1 (1)

q(x) = x2 + 2x + 3 (2)

1) Create a list of coefficients and the corresponding power of the variable for p(x). Note that the

coefficient of the highest power should be the first in the list.

2) Repeat the exercise for q(x).

Problem 2. Polynomial Addition and Subtraction:

1) Create the coefficient list for p(x) + q(x).

2) Repeat the exercise for q(x) p(x) and p(x) q(x).

Problem 3. Polynomial Multiplication:

1) Generate a list that gives you the coefficients of p2 (x).

2) Repeat the above exercise for q2 (x).

3) Now generate a coefficient list for pn (x). You may use the binomial theorem to generate the coeffi-

cients.

4) Using convolution, obtain the coefficient list for p(x)q(x).

*The author is with the Department of Electrical Engineering, Indian Institute of Technology, Hyderabad 502205 India e-mail:

gadepall@iith.ac.in.
2

5) Generalize the above for polynomials of any size.

6) Obtain pn (x) using convolution repeatedly.

Problem 4. Polynomial Division: Let

q(x) = p(x)g(x) + r(x), (3)

where g(x) is the quotient polynomial and r(x) is the remainder polynomial.

1) Obtain the coefficient list for g(x) and r(x).

2) Generalize this for polynomials of arbitrary sizes.

Problem 5. Binary Search Tree:

1) Enter the list of numbers

S = {3, 6, 2, 1, 5, 9, 4, 7, 0, 8} (4)

into a binary tree in such a fashion that the smaller number goes to the left brach.

2) Access this tree in such a manner as to print the numbers in ascending order.

3) Repeat the exercise to print the numbers in descending order.

4) Try to do both the above exercises using recursion.

Problem 6. Build your own tree for creating the matrix




1 1
A = (5)

1 1

1) Generate At which is the transpose of A.

2) Obtain A + At .

3) Obtain A At .

4) Obtain AAt .

5) Obtain A1 .

6) Generalize all the above operations for square and rectangular matrices of arbitrary size.

S-ar putea să vă placă și