Re: Algorithm for inserting numbers in a list?
- From: Martin Knoblauch Revuelta <mkrevuelta@xxxxxxxxx>
- Date: Thu, 10 Apr 2008 04:24:34 -0700 (PDT)
On 8 abr, 18:36, Chris <spam_me_...@xxxxxxxxxx> wrote:
I have a list of N elements. Each element needs to be assigned an
ascending number, such that the number assigned to the first element is
less than the one for the second, which is less than the third, ... The
number assigned to an element can never change.
[..]
Does it have to be a number? Could it be something else?
You might use pointers to the nodes of the trees. Balancing the tree
doesn't change them. They are not "ascending numbers", but they refer
ascending positions within the in-order traversal of the tree. That
is, using the tree, you can check whether one is lesser or greater
than other one in terms of their positions in the sequence (in
logarithmic time). Of course, this is valid only while you have the
tree... But if you don't, you can map some unique identifiers to the
pointers...
Could you give some more details? Why do you need such a structure?
Cheers,
Martin
.
- Follow-Ups:
- Re: Algorithm for inserting numbers in a list?
- From: Chris
- Re: Algorithm for inserting numbers in a list?
- References:
- Algorithm for inserting numbers in a list?
- From: Chris
- Algorithm for inserting numbers in a list?
- Prev by Date: Re: Goedell's Incompleteness Reconsidered
- Next by Date: Combsort: shrink factor for guaranteed O(n log n) worst case time?
- Previous by thread: Re: Algorithm for inserting numbers in a list?
- Next by thread: Re: Algorithm for inserting numbers in a list?
- Index(es):
Relevant Pages
|