Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask C/C++ Expert


Home >> C/C++

In this exercise you will practice basic C++ class construction, and memory allocation and deallocation. You are asked to implement a class that supports an extendable variant of a sparse matrix (look it up). A matrix is a two-dimensional array. A matrix is sparse when many positions in the array are not important. In usual sparse matrices entries are not important when they are 0. In our version of the saprse matrix we distinguish between existing positions and not existing positions. Existing positions in our sparse matrices could contain the entry 0. In both cases, allocating memory to the unimportant positions in the matrix is a waste of memory. You could think about a database containing students and their grades in modules. Every row in the database corresponds to a student and every column corresponds to a module. Then, grades are to be stored only in modules that the student did take. The entry that corresponds to a module that the student did not take should not exist. In particular, 0 is a possible grade in a module that a student takes.

To summarize, you are going to implement a sparse matrix that stores integers (including 0) in some of the positions of a (relatively large) two-dimensional array. Technically, I have created the header file for the sparse matrix. You have to complete it with additional members. You will have to only submit two files: Sparse.cpp and Sparse.hpp. You will probably want to create your own main.cpp file that includes a program that actually executes your Sparse.cpp. You will not be submitting this file(main.cpp). I also supply a Makefile that you should (must) use for compilation. The Makefile includes a compilation of a main.cpp. The header file includes detailed descriptions of the functions that are required that you implement. Specific requirements: The way to implement this is by having a two-dimensional linked-list (look up linked-list). This essentially means that your matrix is a collection of cells (see the provided Cell.hpp and Cell.cpp) that are connected by pointers to the cells above, below, to their left, and to their right.

This means that your memory requirements are proportional to the number of elements stored in the matrix. Also, every operation that you perform will take time that is proportional to the number of elements in the matrix. The disadvantage of this option is that it is quite complicated to implement. Notice that I set up Cell to be ready for implementing a doubly linked list. Solutions implementing singly-linked data structures will not incur a penalty. However, they will provide fast access in one direction only. In any case, you have to implement the member function whatDidIImplement(). This function returns a value that identifies your solution in this case its "two-dimensional linked-list".

If your function returns a value that does not match your implementation strategy it could cost you up to 5 points. Materials provided: Cell.hpp Cell.cpp Sparse.hpp main.cpp - a small example prepared by Paula showing how to use Cells to create a linked list. main1.cpp - an alternative main file that includes a small test of Sparse. Prepared by Paula. mmain.cpp - compilation tester. Makefile tests.cpp - test cases Avoid Compilation Problems: In order to make sure that your program compiles you should put in a fresh directory your submission (Sparse.cpp, Sparse.hpp), the Makefile from above, Cell.cpp and Cell.hpp from above, and the file mmain.cpp from above. Change the name of mmain.cpp to main.cpp and compile using make. This should produce an executable called main. It will most likely crash (and that's fine). But it should compile! Operating Sytem Used Linux g++ complier.

Attachment:- Assignment.zip

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M91592291
  • Price:- $210

Guranteed 48 Hours Delivery, In Price:- $210

Have any Question?


Related Questions in C/C++

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As