Re: Algorithm for inserting numbers in a list?
- From: Martin Knoblauch Revuelta <mkrevuelta@xxxxxxxxx>
- Date: Wed, 9 Apr 2008 09:07:45 -0700 (PDT)
On 8 abr, 18:36, Chris <spam_me_...@xxxxxxxxxx> wrote:
[..]
My thought is that this problem is not unlike building a tree, except
that most tree-building algorithms have some means of rebalancing the
tree as one branch gets too long. The requirement that the ascending
number or key assigned to an element can never change, though, makes
rebalancing hard.
Does anyone have a suggestion for a different data structure I can use?
You _can_ use a balanced search tree as long as you store the keys in
the nodes. I mean storing the full string of every key in the
corresponding node. If long strings are a problem, use a rope (http://
en.wikipedia.org/wiki/Rope_%28computer_science%29).
Cheers,
Martin
.
- References:
- Algorithm for inserting numbers in a list?
- From: Chris
- Algorithm for inserting numbers in a list?
- Prev by Date: Re: Algorithm for inserting numbers in a list?
- Next by Date: Re: How can I tell if F is a string or if it is a number?
- 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
|