Re: Optimal Structure for Inserting and Deleting

Brady Kelly <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.clr
Message-ID <[email protected]>
Thanks Fabian and Frans,

The list stores an abstraction of output lines in report (csv export) bands.
E.g. My default band only contains one line, defined by line layout
"Detail1", but often every detail record requires more than one line, so a
logical invoice detail line requires two output lines, in order.  A group
footer at the end of each invoice will also require one or more output
lines.  The linked list stores all output lines, in order from the first
header, through to the last footer.

To avoid requiring too much knowledge of output line types and their
ordering, I chose a data structure that would preserve ordering during
inserts, deletes, and swaps, without relying on redundant keys created for
the output lines.  Without a lot of time nor great familiarity with such
collection classes, from my old study days, a linked list seemed an ideal
initial choice.

Slightly OT appendix:

Maybe you learned gents could suggest another avenue?  I am building an
editor for the definitions of these reports/exports, and these definitions
are maintained in an object model of my making, and persisted in an XML
schema of my making.  I have today been briefed to investigate using an XML
editor for direct editing of the XML by our support staff in maintaining
these definitions, but this seems a little unconstrained for me.  I would
prefer the user only be able to e.g. choose field names rather than type
them in manually.


> >        But above all, what do you want to do with the list?
>
> I think that's the main question. Do you need to do heavy processing
> on very long lists? Then choose a very efficient data structure.
> Or do you modify reasonably short lists every once in a while? Then
> just use a List<T> and be done with it. (That's not efficient for
> insertions/deletions at other places than the end, but for such a
> scenario, that won't matter anyway.)
>
> It all depends...
>
> Fabian

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.