This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Progamming assignment 2 – linked lists due zipfile – Thursday, October 5th at 10am hardcopy – Thursday, October 5th in the beggining of the class . In this assignment you’ll be dealing with a list of integers. The assignment should give additional practice with pointers and dynamical memory allocation. The goal is to implement several functions that manipulate nodes in a linked list. This functions include the traditional like inserting, removing, searching, as well as several function relevant to the data structures we’ll be dealing with – scalar product, addition, transpose, and multiplication. There are two types (though similar) of nodes we’ll be using. One is ElementNode struct ElementNode { int data; int pos; struct ElementNode *next; }; and RowNode struct RowNode { int pos; struct ElementNode *elements; struct RowNode *next; }; both are used to create singly linked lists of corresponding nodes. The data part of the ElementNode is an integer and its position. This may be used to represent a very long vector of numbers most of which are 0’s. Example vector (0 , , , 1 , 2 , , , 0) is a vector with 1 at position 3 and 2 at position 5 (counting from 0). Which looks like (1,3)>(2,4) , where first number in the pair is the value and second is its position. This way we save storage space. This type of vector is usually known as sparse vector . List representation has only one drawback – it doesn’t remember the length of the original vector, e.g. both (0has only one drawback – it doesn’t remember the length of the original vector, e....
View
Full
Document
This lab report was uploaded on 04/18/2008 for the course CS 225 taught by Professor Volper during the Fall '06 term at DigiPen Institute of Technology.
 Fall '06
 Volper

Click to edit the document details