当前位置:天才代写 > C++/C代写 > data structure1代写 matrix代写 data structure代写 program代写

data structure1代写 matrix代写 data structure代写 program代写

2021-01-10 11:46 星期日 所属: C++/C代写 浏览:102

data structure1代写

DSA 5005 – Computing Structures – Fall 2019 Project 2 – Due on October 19th 2019

data structure1代写 CSR: A rectangular array of numbers is called a matrix. Sometimes a matrix is referred as a table, 2-dimensional array,or array of arrays.

Introduction:

CSR: A rectangular array of numbers is called a matrix. Sometimes a matrix is referred as a table, 2-dimensional array, or array of arrays. Consider the following matrix below. It has 5 rows (denoted n) and 8 columns (denoted m). As you can see the row and column numbers start with a 0.data structure1代写

data structure1代写
data structure1代写

The empty cells have the same common value (it can be assumed as 0). The above matrix is said to be sparse because the total number of common values is significantly large in comparison to other non-common values in the matrix. In the example above, we have a total of 40 values in the matrix (8 ´ 5), 10 non-common/zero values, and 30 common values.Computing Structures1代写

You can store such a sparse matrix in different formats which will lead to less space complexities. The one method which we are going to be implementing here is called the Compressed Sparse Row(CSR) format. In this format, the matrix n x m is stored in 3 one dimensional arrays – valueArray, IA and JA.

  • valueArray – contains all the non-common values; this array will be of length numNZV which is the number of non-common/non-zero values present in the given inputmatrix
  • IA – contains the cumulative number of non-common values in arow
  • JA – contains the column number of the non-common value present; length isnumNZV data structure1代写

Let us take the example from above and walk through this.

valueArray = [100, 900, 500, 200, 300, 400, 800, 200, 1600, 700]

IA = [0, 3, 5, 7, 8]

JA = [0, 3, 5, 4, 7, 1, 6, 2, 0, 4]data structure1代写

You can find more information and explanation on this link: https://en.wikipedia.org/wiki/Sparse_matrix

Graph and matrix correlation: A very popular data structure to store graphs is by using matrices called the Adjacency Matrix. The values in the matrices are the edge weights connecting the vertex from the corresponding row number vertex to the column number vertex. Edge existence is to determine whether there exists an edge between the vertices given.data structure1代写

GetNeighbours should get all the neighbours of the node given to the method. You are also required to do a Breadth First Search and a Depth First Search on the given start node – you are required to save the sequence of this BFS and DFS on an array and return it(hence the return type for the methods is int*). You are allowed to use the queue and stack stl libraries for the implementation of these two methods. You can find more information about this in Chapter 11.5 from the book and also the videos that will be released.

data structure1代写
data structure1代写

Implementation note: data structure1代写

All these graph operations have to be done directly on the CSR data structure(3 one dimensional arrays) and you are not supposed to un compress the data structure into a matrix for these operations.

On a higher perspective, in this project, you will create appropriate C++ classes (given in sampleMain.cpp) to create the compressed sparse matrix representation data structure and do the graph operations(edge existence, getNeighbours, DFS and BFS) on the compressed sparse row matrix.

Your project implementation: As part of this project, you will create a class names CSR as given in sampleMain.cpp. This class will have the fields which we used above to store the matrix and also other methods necessary. A sampleMain.cpp(the following code) is also given to you along with this description.data structure1代写

Input: You must ensure that your program outputs the output in the exact format provided in the sample outputs. The input file will be of the following format:

5 8 10 // <- numRows, numCols and numNZV

// <- entire input matrix

1600 0 0 0 700 0 0 0

0 3 // <- vertices for edge existance

2 // <- vertex for getNeighbours

1 // <- start vertex for BFS and DFS

The first line reads – 5 rows, 8 columns and 10 being the number of non-sparse values in the matrix. You are also required to overload the ostream operator to display the matrices in matrix format from the CSR object. Example inputs for the above given program have been posted in canvas under the Project 2 tab.

Submission: data structure1代写

The code must be submitted in GradeScope(more instructions on this will be made as an announcement) where they will be auto graded with the sample set of inputs and outputs and will be officially graded later with more exhaustive input files.

There is a sample hello world auto grader project setup on GradeScope for testing purposes, please go ahead and upload a HelloWorld program there. You need to print this exactly – “Hello World!” followed by a new line. And your file has to be named as ‘helloworld.cpp’. This is a test, so please upload asap and make sure it works. You should past test case 1.

Redirected Input:

Redirected input provides you a way to send a file to the standard input of a program without typing it using the keyboard. To use redirected input in Visual Studio environment, follow these steps: After you have opened or created a new project, on the menu go to project, project properties, expand configuration properties until you see Debugging, on the right you will see a set of options, and in the command arguments type <“input filename”. The < sign is for redirected input and the input filename is the name of the input file (including the path if not in the working directory). A simple sample program that reads a matrix can be found below.data structure1代写

#include <iostream> using namespace std; int main ()

{

int r,c,cv,nsv; int val;

cin >> r >> c >> nsv;

for (int i=0; i < r; i++) {

for (int j=0; j < c; j++) { cin >> value;

cout << value <<  “;

}

endl;

}

return 0;

}

Constraints:

  1. In this project, the only headers you will use are #include <iostream>, #include<queue> and#include<stack>.data structure1代写
  2. None of the projects is a group project. Consulting with other members of this class on programming projects is strictly not allowed and plagiarism charges will be imposed on students who do not follow this.
data structure1代写
data structure1代写

其他代写:考试助攻 计算机代写 java代写 assembly代写 function代写paper代写 金融经济统计代写 web代写 编程代写 report代写 数学代写 finance代写 python代写 java代写 code代写 代码代写 project代写 Exercise代写 assembly代写

合作平台:天才代写 幽灵代写 写手招聘 Essay代写

 

天才代写-代写联系方式