We can also use jagged arrays for this purpose

int[][] symmetric_matrix = new int[size][];

for (int i=0; i < size; i++)
.......symmetric_matrix[i]=new int[max_diagonal/(size)];



On Wed, Jan 12, 2011 at 9:30 AM, Sathaiah Dontula <don.sat...@gmail.com>wrote:

> 1 + 2 + .... + n ( max diagonal) = n ( n + 1) / 2.
> Max elements you can store is n ( n + 1) / 2 .
> You can take an array of size n (n + 1) / 2 and store them.
>
> Thanks,
> Sathaiah
>
> On Wed, Jan 12, 2011 at 9:50 AM, Azhar Hussain <azhar...@gmail.com> wrote:
>
>> I have a symmetric matrix. I am wondering what would be the best data
>> structure to store such a matrix? How many elements do I need to store for a
>> nxn matrix?
>>
>> Thanks in advance for the help.
>>
>> -
>> Azhar.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Umer

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to