• Home
  • Blog
  • Use m singly linked lists to represent an m xn sparse matrix A, i.e. the values in a small portion o

Use m singly linked lists to represent an m xn sparse matrix A, i.e. the values in a small portion o

0 comments

HIRE QUALIFIED ACADEMIC WRITERS 

Usem singly linked lists to represent anm xn sparse matrix A, i.e. the values in a small portion of cellsare non-zero, wherem andn can be quite large.Hence, array implementation will not be ACCEPTED.Write a program in Java to construct A. In this program, the input,i.e.m andn, should be inputted by a user.Moreover, the program needs to provide the following fivefunctions:1.Get the value at A(i, j) as given i and j;2. Insert the value at A(i, j) as given i and j;3. Delete the value at A(i, j) as given i and j;4. Print the values at the jthcolumn of A asgiven j; 5. Print the values at the ithrow of Aas given i; where1≤i ≤m and1 ≤j ≤n. Sample input and output: Sparse Matrix setup No. of rows:5No. of columns:4 5 x 4 sparse matrix is created. >insert 10 3 2Inserted 10 to cell(3,2). >insert 20 2 3Inserted 20 to cell(2,3). > insert 30 1 1Inserted 30 to cell(1,1). > insert 40 2 2Inserted 40 to cell(2,2). > row 20 40 20 0 >col 2 0 40 10 0 0 >delete 2 3 delete cell(2,3). >get 2 3The value of cell(2,3) is 0. >get 3 2The value of cell(3,2) is 10. >stopThank you for using this program! Please don’t just copy the answer from the question thatI asked. getRow() and getCol() are needed. . . .

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}