It doesn't come up much in the class but does anyone know much about implementing a Tree Data Structure in python. I'd like to find a tutorial about how to do one to represent a family. Thanks.

At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get our expert's

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions.

A community for students.

It doesn't come up much in the class but does anyone know much about implementing a Tree Data Structure in python. I'd like to find a tutorial about how to do one to represent a family. Thanks.

MIT 6.00 Intro Computer Science (OCW)
See more answers at brainly.com
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions

I'm currently working on problem set 8, and in this problem set you have to use a binary tree. It uses recursion to transverse the tree and uses it to solve a Knapsack Problem. Might be helpful. Although I am having trouble with this problem set at the moment.
Hey thanks for the reply. I have to do mine with OOP though like: class Node class Family etc.
have you worked with linked lists at all? I should be similar? except that it points too 2 places instead of 1

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

My current implementation for the Node is: class Node(object): def __init__(self, name): self.name = name self.children = [] self.parent = None for item in relationdict: if relationdict[item] == self.name: self.children.append(item) relationdict is just a dictionary mapping sons to fathers This is working fine but when I try to extend it to make a family I keep failing.
I found an implementation of a binary tree, might help, http://code.activestate.com/recipes/286239-binary-ordered-tree/ unfortunately i do not know much about implementing a tree data structure or what you mean by a family.
Sorry I meant Tree, the Tree is to represent a Family

Not the answer you are looking for?

Search for more explanations.

Ask your own question