Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C A sparse matrix is a two-dimensional array in which a large number of the elements are zero. A concise text file representation of

In C

A sparse matrix is a two-dimensional array in which a large number of the elements are zero. A concise text file representation of a sparse matrix needs to store only the array dimensions on the first line and the number of nonzero elements on the second. Each of the remaining lines should contain three numbersrow subscript, column subscript, and value of one nonzero entry. Write a program that converts a text file containing a traditional matrix representation to a text file containing a compressed sparse matrix. The program should open the file containing the traditional representation (a line with dimensions followed by matrix contents a row at a time), call a function scan_matrix to input the matrix, open the output file, and call a function write_sparse to store the compressed representation. Write a second program that reverses the processdoing input of a sparse matrix file and creating a file containing the traditional representation. For the second program, write functions scan_sparse and write_matrix.

Must be able to take the following sparse matrix as a .txt file

1 1 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 1 1 0 1 1 1 1 1 0 0 0 1 1 1 1 1 0 1 0 0 1 0 0 1 1 1 1 0 0 1 0 0 0 1 1 1 0 0 0 0 1 1 0 1 0 0 1 1 1 0 1 0 1 0 0 1 0 0 0 0 1 1 0 0 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1 0 0 1 0 0 1 1 1 0 0 1 1 0 0 0 0 0 0 1 1 1 0 1 0 1 0 0 1 0 0 0 1 1 1 1 1 0 0 1 1 1 0 1 0 1 0 0 0 1 1 1 1 1 0 0 0 0 1 1 0 1 1 1 0 1 0 0 1 0 0 1 1 1 0 0 1 0 1 0 0 1 1 0 0 1 0 1 0 0 1 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 0 0 1 0 1 1 1 1 0 1 1 0 1 1 0 0 0 1 1 0 0 1 0 0 0 0 1 0 1 1 1 1 1 1 0 1 1 0 0 0 1 0 1 1 1 1 0 0 1 0 0 0 0 0 0 1 1 0 1 1 0 0 1 0 1 1 1 1 0 1 1 0 0 0 1 0 1 0 0 0 0 1 0 0 1 0 1 0 1 1 1 1 0 1 0 0 1 1 0 1 0 1 1 1 0 1 1 0 1 0 0 0 0 0 1 1 1 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1 0 0 1 1 0 1 1 1 1 0 0 0 1 1 0 1 0 1 0 0 0 1 0 0 1 1 0 1 0 1 1 1 1 1 1 0 1 1 0 1 1 0 0 0 1 0 1 1 0 0 1 1 1 1 0 0 1 0 0 1 1 1 0 1 0 0 0 1 0 0 1 1 0 0 0 0 1 0 1 1 0 1 1 0 0 0 0 1 1 0 1 1 0 0 0 0 1 1 0 1 1 0 0 0 1 0 0 1 1 1 1 1 1 0 1 0 0 0 1 1 0 0 0 1 0 1 0 1 1 0 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic6 Database Programming

Authors: John W. Fronckowiak, David J. Helda

1st Edition

0764532545, 978-0764532542

More Books

Students also viewed these Databases questions

Question

5. Arranging for the training facility and room.

Answered: 1 week ago

Question

1. Discuss the five types of learner outcomes.

Answered: 1 week ago