Question: Question 3: In class we talked about binary trees and in lab you worked on ternary trees. Here is some code for initializing a node

 Question 3: In class we talked about binary trees and in

Question 3: In class we talked about binary trees and in lab you worked on ternary trees. Here is some code for initializing a node in a binary tree: class Node: def __init__(self, value - None, left - None, right - None): self.value - value self.left - left self.right - right Copy and paste this code into your quiz code. Normally, we constructed our binary trees using a specific method that automatically arranged nodes according to whether their values were larger or smaller, but we don't have to. We can create trees however we want. a) Using the Node class above, write three lines of code to create three nodes that are arranged like this (you do NOT have to print anything, you only have to abstractly create the nodes): 6 / 9 8 b) Using the Node class above, write four lines of code to create four nodes that are arranged like this: 6 1 9 10 2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!