Well, u can use List of Lists. The List would contain head nodes of all the
lists and each list would contain a row. The length of every list will be 1
greater than the next of it's next list.

In this way:

The tail of list would contain a diagonal element which

       L
 L1  1
 L2  4 2
 L3  4 3 4
 L4  5 4 4 2


On Thu, Jan 13, 2011 at 2:50 PM, Azhar Hussain <azhar...@gmail.com> wrote:

> I am wondering what data structure would best suit for this?
>
> -
> Azhar.
>
>
> On Wed, Jan 12, 2011 at 11:11 AM, Abdul Rahman Shariff <ears7...@gmail.com
> > wrote:
>
>> i can tell 1 thing tht only
>> (((n*n)-n)/2) +n elements are unique and the "(((n*n)-n)/2)" term is the
>> one shoes the no of repeated elements and n represents the
>> diagonal elements hope this gives some usefull info (i havent gone through
>> any book nor do i guarantee optimal or best memory usage)
>>
>>
>> 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.
>>>
>>
>>
>>
>> --
>> Ehab Abdul Rahman Shariff
>>
>> --
>> 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