in DS recategorized by
2,657 views
0 votes
0 votes
How many real links are required to store a sparse matrix of 10 rows , 10 columns ,and 15 non zeros entries.(pick up the closest answer)
in DS recategorized by
2.7k views

4 Comments

@Abhilash that would make 30 rt? Question should have mentioned that.
0
0
edited by

@Arjun Sir,
30 for those 15 entries + some more links for the heads of the lists(But this also depends on how you define the data structures, whether you use head nodes or not, etc)..

The pic below is an example taken from Data Structures in C by horowitz and sahani.

But then, the same book also gives the data structure you talked about with the row id and column id..
So, the question should have clearly mentioned it. Otherwise its ambiguous which data structure should one use.

PS: I dont think such a question would come in GATE unless the code for the data structure is explicitly mentioned.

1
1
Yes sir, nothing more is mentioned in question. In best case 15 should be correct.
1
1

1 Answer

0 votes
0 votes
Full matrix = 10 * 10 = 100
Sparse matrix = 100/2 = 50
because in most of the cases sparse matrix take half the size of full matrix as in triangular matrix.

1 comment

how can we assume a special sparse matrix?
0
0