tree data structure

V

vivek khurana

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? I have searched archives and
manuals but no luck.

Regards
VK

Hug the REALITY ;-)



Disclaimer
The facts expressed here belong to everybody, the opinions to me. The distinction is yours to draw...



__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/
 
D

Dan Bishop

vivek said:
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)))
 

Ask a Question

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.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,228
Messages
2,571,157
Members
47,785
Latest member
deepusaini

Latest Threads

Top