Define a binary tree structure using a list for each node. Each node should have the following structure:
['name', left_sibling, right_sibling]
where left_sibling and right_sibling are either the node list data structure or None.
Write a recursive function that walks the tree and shows the name of each node.
Define a tree structure using a list for each node and a list to contain the chidren under each node. Each node should have the following structure:
['name', [child1, child2, ...]] # or ['name', []]
Write a recursive function that walks the tree and shows the name of each node.
Define a binary tree structure using a dictionary for each node. Each node should have the following structure:
{'name': 'the name', 'lsib': left_sibling, 'rsib': right_sibling}
where left_sibling and right_sibling are either the node dictionary data structure or None.
Write a recursive function that walks the tree and shows the name of each node.
Define a class Node to represent each node of a binary tree. The class should have the following instance variables:
Also implement a method in class Node to recursive walk the tree and show the name of each node.
What you will learn: