Re: C# Deque found on the web--thanks to The Game Programming Wiki
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Wed, 8 Aug 2007 19:16:10 +0100
Peter Duniho <NpOeStPeAdM@xxxxxxxxxxxxxxxx> wrote:
Jon Skeet [C# MVP] wrote:
[...]
I *could* have used LinkedList for this (except that I originally wrote
it before 2.0, of course) but it feels more like a "queue with
occasional random access" than a normal linked list. (Finding the right
point to insert a new item is also quicker this way than with a linked
list.)
Well, you are free to call it a queue, of course. But it's not really a
queue, at least not a pure one. :)
I'm curious what it is about your implementation that makes insertion of
new items faster than if using a linked list?
The queue is ordered by priority, so it can use a binary search to find
the correct insertion point. Binary search on a linked list isn't
terribly fast :)
Admittedly it won't matter unless you've got thousands of items on the
queue...
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
.
- Follow-Ups:
- Re: C# Deque found on the web--thanks to The Game Programming Wiki
- From: Peter Duniho
- Re: C# Deque found on the web--thanks to The Game Programming Wiki
- References:
- C# Deque found on the web--thanks to The Game Programming Wiki
- From: raylopez99
- Re: C# Deque found on the web--thanks to The Game Programming Wiki
- From: Peter Duniho
- Re: C# Deque found on the web--thanks to The Game Programming Wiki
- From: Jon Skeet [C# MVP]
- Re: C# Deque found on the web--thanks to The Game Programming Wiki
- From: Peter Duniho
- C# Deque found on the web--thanks to The Game Programming Wiki
- Prev by Date: Getting ip addresses on the network
- Next by Date: Re: System.DirectoryServices Will not work
- Previous by thread: Re: C# Deque found on the web--thanks to The Game Programming Wiki
- Next by thread: Re: C# Deque found on the web--thanks to The Game Programming Wiki
- Index(es):
Relevant Pages
|