Python & binary tree help PLEASE?!?????????please please please help me in anyway :'(?
Write a Python program that :
a: Takes in as input a list of numbers (Note that you have to type in these numbers using the
keyboard)
using:
def insert(tree, key):
if len(tree) == 0:
return [key, [], []]
else:
if key < tree[0]:
return [tree[0], insert(tree[1], key), tree[2]]
else:
return [tree[0], tree[1], insert(tree[2], key)]
def construct(ls, tree):
if len(ls) == 0:
return tree
else:
return construct(ls[1:], insert(tree,ls[0]))
def main(ls):
if len(ls) == 0:
return []
else:
t = construct(ls, tree)
print t
ls = []
#Write code to enter your letters here one by one and add each one of them to the list ls
tree = []
main(ls)
c: Add a function called total() that takes in as input this list and and finds the sum of all the nodes in
the constructed binary tree.
d: Return as output, the total value of all the nodes in the binary tree.
i have no idea what to add by " #Write code to enter your letters here one by one and add each one of them to the list ls", please anyone help?? :( even steps or ANY help at all please:((((