Representation of a sparse matrix, Data Structure & Algorithms

Assignment Help:

Let us assume a sparse matrix from storage view point. Assume that the entire sparse matrix is stored. Then, a significant amount of memory that stores the matrix consists of zeroes. It is nothing but wastage of memory. In real life, such wastage might count to megabytes. Thus, an efficient method of storing sparse matrices ought to be looked into.

Figure illustrates a sparse matrix of order 7 × 6.

 

 

0

 

1

 

2

 

3

 

4

 

5

 

0

 

0

 

0

 

0

 

5

 

0

 

0

 

1

 

0

 

4

 

0

 

0

 

0

 

0

 

2

 

0

 

0

 

0

 

0

 

9

 

0

 

3

 

0

 

3

 

0

 

2

 

0

 

0

 

4

 

1

 

0

 

2

 

0

 

0

 

0

 

5

 

0

 

0

 

0

 

0

 

0

 

0

 

6

 

0

 

0

 

8

 

0

 

0

 

0

 

Figure: Representation of a sparse matrix of order 7 × 6

A general way of representing non zero elements of any sparse matrix is the 3-tuple form. The primary row of sparse matrix always indicates the number of columns, the number of rows, & number of non zero elements in the matrix. The number seven represents the entire number of rows sparse matrix. Alike, in the matrix the number six represents the total number of columns. The number eight represents the overall number of non zero elements in the matrix. Each of non zero element is stored from the second row, along the 1st & 2nd elements of the row, mentioning the row number & column number respectively wherein the element is present in the original matrix. In this row the 3rd element stores the actual value of the non zero element. For instance, the 3- tuple representation of the matrix of Figure is illustrated in Figure

1382_Representation of a sparse matrix.png

Figure: tuple representation of above figure

The following program 1 accepts a matrix as input that is sparse & prints the corresponding 3-tuple representations.


Related Discussions:- Representation of a sparse matrix

Program on radix sort., Write a program that uses the radix sort to sort 10...

Write a program that uses the radix sort to sort 1000 random digits. Print the data before and after the sort. Each sort bucket should be a linked list. At the end of the sort, the

Write an algorithm to illustrate this repeated calculation, The below formu...

The below formula is used to calculate n: n = (x * x)/ (1 - x). Value x = 0 is used to stop the algorithm. Calculation is repeated using values of x until value x = 0 is input. The

Linear search, Linear search is not the most efficient way to search an ite...

Linear search is not the most efficient way to search an item within a collection of items. Though, it is extremely simple to implement. Furthermore, if the array elements are arra

Acyclic graphs, Acyclic Graphs In a directed graph a path is said to fo...

Acyclic Graphs In a directed graph a path is said to form a cycle is there exists a path (A,B,C,.....P) such that A = P. A graph is called acyclic graph if there is no cycle in

How do you rotate a binary tree, How do you rotate a Binary Tree?  Rot...

How do you rotate a Binary Tree?  Rotations in the tree: If after inserting a node in a Binary search tree, the balancing factor (height of left subtree - height of right

Determine about the post conditions assertion, Determine about the Post con...

Determine about the Post conditions assertion A  post condition is an assertion which should be true at completion of an operation. For instance, a post condition of the squ

Enumerate about the carrier set members, Enumerate about the carrier set me...

Enumerate about the carrier set members Ruby is written in C, so carrier set members (which is, individual symbols) are implemented as fixed-size arrays of characters (which is

Arrays and pointers, C compiler does not verify the bounds of arrays. It is...

C compiler does not verify the bounds of arrays. It is your job to do the essential work for checking boundaries wherever required. One of the most common arrays is a string tha

Recursive function, The location of a node in a binary search tree is defin...

The location of a node in a binary search tree is defined as a string such as LLRRL, which represents the node that you find by starting at the root, and traversing Left, traverse

Linked List Variations, Part1: Deque and Bag Implementation First, complet...

Part1: Deque and Bag Implementation First, complete the Linked List Implementation of the Deque (as in Worksheet 19) and Bag ADTs (Worksheet 22). Files Needed: linkedList.c Linke

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd