Collections PV178: Programming for .NET Framework CLI Libraries, Base Class Library (seminar) Vojtˇech Forejt, forejt@fi.muni.cz Martin Osovsk´y, osovsky@ics.muni.cz Faculty of Informatics and Institute of Computer Science Masaryk University February 26, 2009 Collections Motivation ­ "Sparse List" List in which many items are missing (i.e. have default value). Memory-saving implementation is desirable. Collections Sparse List Download and open SparseListExample.zip from IS SparseList implements IList How it works: variable count denotes real size of the list. Two arrayslists: indices and values. Non-default item item is at position k in the sparse list iff then for some n we have indices[n]=k and values[n]=item. numbers in indices are sorted incrementally. E.g. for sparse list of integers: count=6, indices={1,3} and values={9,8} determine list {0,9,0,8,0,0}. Collections Sparse Lists ­ Assignment 1 Implement the things that are missing (to find out which ones, try to build the project) 2 Implement static method WriteToFile(SparseList,string) in Program. The method should output elements of the list to the file given by string, each element at one line. Collections Homework Will be available in IS by tomorrow morning Topic: Enumerators, Streams, Filesystem Deadline: March 15, 2009