root node( root insert( root insert( root insert( root insert( root insert( root insert( print(root inordertraversal(root)when the above code is executedit produces the following result[ pre-order traversal in this traversal methodthe root node is visited firstthen the left subtree and finally the right subtree in the below python programwe use the node class to create place holders for the root node as well as the left and right nodes thenwe create an insert function to add data to the tree finallythe pre-order traversal logic is implemented by creating an empty list and adding the root node first followed by the left node at lastthe right node is added to complete the pre-order traversal please note thatthis process is repeated for each sub-tree until all the nodes are traversed class nodedef __init__(selfdata)self left none self right none self data data insert node def insert(selfdata)if self dataif data self dataif self left is noneself left node(dataelseself left insert(data