tree data structure
Dan Bishop
danb_83 at yahoo.com
Sat Mar 26 02:12:05 EST 2005
vivek khurana wrote:
> Hi! all
>
> i am a new member on this list. I have to implement
> tree data structure using python. How it can be done
> in python. Is there an existing data structure which
> can be used as tree?
Tuples can be used as trees: you can let them represent (data,
left_child, right_child).
# a binary search tree for the integers 0 to 6
(3, (1, (0, None, None),
(2, None, None)),
(4, (5, None, None),
(6, None, None)))
More information about the Python-list
mailing list