Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Apr 2010 13:41:34 -0400
From:      Leinier Cruz Salfran <salfrancl.listas@gmail.com>
To:        Alexander Churanov <alexanderchuranov@gmail.com>
Cc:        freebsd-hackers <freebsd-hackers@freebsd.org>
Subject:   Re: c question
Message-ID:  <s2ia2585ef1004091041waab4064i51a794c0716cf917@mail.gmail.com>
In-Reply-To: <x2z3cb459ed1004090752q70f6315fqb53ba36d26ce9c12@mail.gmail.com>
References:  <l2ga2585ef1004090709u821fc979i226a3125d9da8251@mail.gmail.com> <x2z3cb459ed1004090752q70f6315fqb53ba36d26ce9c12@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Apr 9, 2010 at 10:52 AM, Alexander Churanov
<alexanderchuranov@gmail.com> wrote:
> 2010/4/9 Leinier Cruz Salfran <salfrancl.listas@gmail.com>
>>
>> - use a matrix is faster than use a linked list?
>>
>> example:
>>
>> char *szColumnName[10];
>> unsigned short iColumnAge[10];
>>
>>
>> struct _llList {
>> =A0struct _llList *prev, *next;
>> =A0char szName[64];
>> =A0unsigned short iAge;
>> =A0};
>
>
> Leinier ,
> This depends on what kind of operations are performed. For sequential
> traversing, both are very appropriate. However, you can not perform a bin=
ary
> search on a list. You also can not combine two arrays into a single one w=
ith
> constant complexity.
> Lists also have greater memory overhead for small structures.
> My advice: always use arrays.
> Use lists if:
> 1) Copying items when the dynamic arrays grows is inappropriate.
> 2) List-specific operations like O(1) splicing or O(1) insertions and
> deletions are required.
> Alexander Churanov
>

hello alexander

i supposed that a matrix is much faster .. i coded my program to use
matrix in that portion but i sent the question to see what others
think about this

thanks



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?s2ia2585ef1004091041waab4064i51a794c0716cf917>