**CS281: ADVANCED PROGRAMMING
LAB.**

*Instructor: Dr. Sukhendu
Das*

LAB HOURS: Tuesday (2:00PM - 4:30PM)

Teaching Assistants: Vinod, Dyana, Manisha, Sunando Sengupta

The following is the list of assignments for the the even semester JAN-APR 2006:

__1. Weekly Assignments (Short Term):__

1.1. WEEK 1:

*i*) Given a sequence of numbers in a file,
find the mean and variance. Do not make assumptions on the length of the file.
Test1.dat

*ii*) Solve the given system of linear equations with 2-5 unknowns. Read the coefficients from the input file Test21.dat Test22.dat Test23.dat

1.2. WEEK 2:

*i*) Find all the prime factors of a number (assume that number is 'long int').

*ii*) Given a sequence of numbers in a file (create your own file), interpolate using linear and quadratic interpolation.

1.3. WEEKS 3-4:

*i*) Implement a class Matrix with the following functions:

*a*) Read a matrix from a given text file (the first row of the text file contains the size of the matrix) Test3.mat;

*b*) Print the matrix;

*c*) friend function to multiply two matrices. The function should have the following declaration : Matrix multiplyMatrix(Matrix&, Matrix& ).

*ii)*
Use the above class to find product of three or more matrices in the most efiicient order of multiplications.

Your program should accept on command line, the number of matrices to multiply and the text files containing those matrices.

1.4. WEEK 5:

*i) *Implement the class "Linked List" with the following functions

*a*) Read words from an arbitrary length text file in a single pass.

*b*) Word Search: For an input text file of arbitrary size, represent the words as a linked list and search for a given test word.

If the word is present, output each location of its occurence.

1.5. WEEK 6:

*i)* Implement Postfix Expression Evaluation using Stacks

1.6. WEEK 7:

*i) *Fit a line, in polar coordinate form, on a given set of data points (read from a given file) using least squares method.
Test.dat

1.7 WEEK 8:

* *
Supplementary Lab Class for Pending Assignments (for students who are yet to complete till Problem 1.6)

1.8 WEEK 9-10:

*i)* Create a Binary tree representation of

an arithmetic expression

*ii)* Print and evaluate the arithmetic expression in

*
(a) * Infix form with parenthesis

*
(b)* Post-fix form

*(c)* Pre-fix form

1.9 WEEK 11:

Extend the class 'Binary Tree' to store words with the methods to

*i)* Add nodes from a given text file (each word as a node)

*(ii)*Search nodes using binary search

*(iii)*Delete Nodes

1.10 WEEK 12:

Given the sequence of numbers in a file, sort using bubble sort and compare timing with quick sort. Implement both, and make no assumptions on file size.

1.11 WEEK 13:

Long Term Assignment Evaluation.

1.12 15th April, 2006 (10-12:30 PM)

Long Term Assignment Evaluation

1.13 WEEK 14:

Given the AVL tree below, insert node '1' and use single rotation to maintain the balance condition. Implement using

*(i)* Pointers (left child, right sibling)

*(ii)*Arrays

Show the result in the form of an array.

15 | 5 | 20 | 3 | 10 | 17 | 21 | 2 | 4 |

For any clarifications, mail to TAs (vinod[AT]cse[DOT]iitm[DOT]ernet[DOT]in) (mkalra[AT]cse[DOT]iitm[DOT]ernet[DOT]in)