Re: Efficient Data Structures
- From: "Brian Gideon" <briangideon@xxxxxxxxx>
- Date: 13 Dec 2005 14:55:40 -0800
Rick Lones wrote:
> You won't *necessarily* get great efficiency on both insertion and removal. But
> given your description so far it sounds as if you can - I would try a
> SortedList. The insertion uses .Add(object key, object value) - which *should*
> be efficient, at least if the key elements arrive in anything like random order.
> (Test it!) You can remove elements either with .Remove(object key) or
> .RemoveAt(int index) - index being 0 in your case of removing the element with
> least key. Either of these *should* be quite efficient (O(log n) at worst) *if*
> the list is internally maintained sorted as per the documentation. (Again, test
> it!)
>
> HTH,
> -rick-
Actually, Add and Remove on the SortedList are O(n log n)
implementations.
.
- Follow-Ups:
- Re: Efficient Data Structures
- From: Brian Gideon
- Re: Efficient Data Structures
- References:
- Efficient Data Structures
- From: Curious
- Re: Efficient Data Structures
- From: Rick Lones
- Efficient Data Structures
- Prev by Date: Re: Efficient Data Structures
- Next by Date: Re: Why copy local with DLL in VS.NET?
- Previous by thread: Re: Efficient Data Structures
- Next by thread: Re: Efficient Data Structures
- Index(es):
Relevant Pages
|
Loading