A
Does this type bear any relationship at all to what most people call aAntoon said:
Does this type bear any relationship at all to what most people call a
tree, which is a bifurcated data structure? Or do you call it a tree for
some other reason?
Sounds like "cdict" might be a better name ...
Steve said:Does this type bear any relationship at all to what most people call a
tree, which is a bifurcated data structure? Or do you call it a tree for
some other reason?
Antoon Pardon said:
Antoon said:I don't know. The python dictionary type with its name, seem to refer
to how it is implemented, so I thought Tree was an appropiate name
here as it is implemented as a tree.
Op 2005-10-12 said:How about adding two shortcut methods, nextkey(k) and prevkey(k), to return the next and previous
key respectively ? For instance nextkey would be equivalent to (untested):
def nextkey(self, key):
iter = self[key:]
first = iter.next()
if key not in self: return first
else: return iter.next()
Also for consistency, nextvalue(k), prevvalue(k), nextitem(k), previtem(k) would be reasonable
additions.
And a question: what does step do if the keys are not integers since you restrict step to be integer
?
.... 'alfa', 'bravo', 'charlie', 'delta', 'echo', 'foxtrot', 'golf', 'hotel', 'india',
['c', 'g', 'k', 'o', 's', 'w']letters = 'abcdefghijklmnopqrstuvwxyz'
from avltree import Tree
t=Tree(zip(radio,letters))
t.keys('choco',None,3) ['delta', 'golf', 'juliet', 'mike', 'papa', 'sierra', 'victor', 'yankee']
t.values('bureau',None,4)
Antoon Pardon said:The underlying implementation is an AVL balanced binary tree with
inorder threading.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.