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)))

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to