Professional Documents
Culture Documents
30 MAY 2016
WEIGHTAGE:
60%
INSTRUCTIONS TO CANDIDATES:
1
Data Structures
Individual Assignment
Page 1 of 4
6 1
1 3
5 7
2 2
9 7
0 9
3 5
0 2
1 6
2 7
Indicates
row no.
7 8
7 5
You are required to write a C++ program that implements the given sparse matrix data
structure, with the following functionalities:
Degree Level 2
2016
Data Structures
Individual Assignment
Page 2 of 4
1. Suitable class(es) to represent a sparse matrix (SM) using the data structure explained
above:
class SM{
int n; int m;
//
# rows, # columns
//
public:
SM ( int rows, int columns );
~SM ( );
void readElements ( );
void printMatrix ( );
SM * addSM ( SM & other );
};
//
3. Read function to allow user to input the non-zero elements of the matrix:
void readElements ( ) { }
reads only the non-zero elements from the user, and properly fills in the
corresponding nodes, and links them correctly. User should keep inputting
arbitrary [row index, column index, and value] triples, with proper indicator to stop
input process.
prints a tabular form showing all zero and non-zero elements of the matrix
(something like Fig. 1)
takes another sparse matrix parameter (which must have same dimensions) and
returns a pointer to a newly created sparse matrix object, whose values are the sum
of corresponding elements of the two matrices (this and other).
properly frees any dynamically allocated memory for the sparse matrix object.
Degree Level 2
2016
Data Structures
Individual Assignment
Page 3 of 4
a suitable code that interacts with the user to test the working of all functionalities,
by at least reading two matrices, printing them, and printing their sum.
Assignment Requirements
You are required to submit a hardcopy as well as a softcopy of assignment report and
source code. The report should contain:
- Detailed explanation of the data structures and classes created, with proper
justification on your decisions (include source code defining classes, data members,
and method headers only).
- Brief explanation about the algorithms used to implement functionalities 2, 3, 4, 5,
and 6 above (include code snippets of important parts of implementation).
- Source code of the main function, with screenshots showing programs input and
output interactions.
You have to present your assignment solution and answers to the lecturer during Q&A
session that will be conducted after hand-in date.
If you use some code which has been taken or adapted from another source (book,
magazine, internet, forum, etc.) then this must be cited and referenced using Harvard
Referencing Style within your source code, and this must be mentioned explicitly in the
report. Failure to reference code properly will be treated as plagiarism.
Automated tools for checking code similarities among submissions will be used, and
all detected cases will be treated as cheating.
Assessment marks are divided as follows:
Marks %
Implementation Quality
Documentation
Presentation
60%
10%
30%
You are required to hand in the individual assignment report on or before the due
date mentioned on the cover sheet of the assignment.
2.
The attached CD should include a softcopy of the report, in addition to the C++
files of the programs. The organization of files and folders must adhere to the
following instructions precisely:
A folder named StudentFirstName-StudentID-Asmnt should contain the
report file (Microsoft Word), and the C++ (*.cpp / *.h) files ONLY. All
additional project files (especially if you use Visual Studio) should be removed.
Make sure to DELETE all non-source-code files, including executables (*.exe).
3.
A zipped file containing CD content and named StudentFirstName-StudentIDAsmnt.zip should be emailed to the lecturer at dr.asem.kasem@apu.edu.my on
submission day itself. The email subject field MUST be set to: DSTR
Assignment - Full Name - StudentID. Failing to send the email on time, or not
following the given guidelines will be considered as no submission.
Degree Level 2
2016
Data Structures
4.
Individual Assignment
Page 4 of 4
5.
Marking Criteria:
The program submitted will be evaluated according to the following performance criteria:
Distinction (90% and above)
Program does not compile or run, but coding logic is almost correct
Between 30% and 50% of the required functionalities are correctly implemented
Implementation uses inefficient data structures or algorithms
Unclear coding style, and no comments provided
Functionalities are not tested/validated in program execution
Degree Level 2
2016