Re: Optimal Structure for Inserting and Deleting
Frans Bouma <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.clr |
|---|---|
| Message-ID | <00fe01c85dd1$55ed9240$01c8b6c0$@nl> |
> 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.
So any sorted list does the trick. I'd opt for SortedDictionary<K, V>
but you can also go for SortedList<K, V>
What's a bit odd is that you need swaps, which could ruin ordering, so
why do you need swapping nodes if what you want is a sorted list?
> 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.
"Xml is machine readable, not human readable"
So xml can be a good storage format, which is consumed/written by a
simple editor :)
FB
===================================
This list is hosted by DevelopMentor® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com