project2a - ECE 2574 Introduction to Data Structures and...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
1 ECE 2574 Introduction to Data Structures and Algorithms Programming Assignment 2: Part (a) Problem: Polynomial addition and multiplication Objective: The main goal of this assignment is to learn about linked lists and their implementation. Other goals are to gain experience with file I/O and command-line arguments. Overview: Suppose we wish to manipulate polynomials of the form: 53 2 () 4 7 9 Px x x x =+− + This polynomial consist of 4 terms , that have coefficients 4, 7, -1, and 9, and exponents 5, 3, 2, and 0, respectively. A polynomial can be represented using a linked list in which each node of the list represents a single term of the polynomial and has three fields: one for the coefficient of the term, one for the exponent of the term, and one for the pointer to the next node of the list (that represents the next term of the polynomial). Given two polynomials 2 35 3 a n d 2 3 x xx ++ + , consider simple operations such as addition and multiplication that may be performed on them: (1) Addition: () 2 2 3 23 37 6 x +++ + −−−−−−− (2) Multiplication: 2 32 2 3 2 3 6 9 10 15 6 9 61 9 2 1 9 x x x x x × + =++ + =+ Program specifications: Write an ADT-based C++ program that reads two polynomials and performs addition and multiplication on them. For this part of the assignment, you are required to specify and define an ADT that has a linked list implementation (for storing and manipulating the polynomials). You should not use any of the ADT classes described in Carrano or the STL to develop your program. You should design and implement your own ADTs from “scratch.”
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Your program should be invoked on the command-line as follows: compute-poly input_file output_file Here, compute-poly is the name of your executable program, and input_file and output_file are the names of the input and output files that will be supplied on the command-line, respectively.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

project2a - ECE 2574 Introduction to Data Structures and...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online