Graphic Python Algorithms: Data Structure and Algorithms for python by Hu Yang

Graphic Python Algorithms: Data Structure and Algorithms for python by Hu Yang
Author: Hu, Yang [Hu, Yang]
Language: eng
Format: epub
Published: 2020-03-28

binary_tree.py

from node import Node

class BinaryTree :

__root = None

@property

def root ( self):

return self. __root

# In-order traversal binary search tree

def inOrder ( self, root):

if root == None :

return

self. inOrder( root. left) # Traversing the left subtree

print ( root. data, ", " , end= "" )

self. inOrder( root. right) # Traversing the right subtree

def remove ( self, node, new_data):

if node == None :

return node

compareValue = new_data - node. data