Visualization of a Binary Tree Creation

Class Definition

class TreeNode:

def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right

Two Variables

  • root — the variable is useful to access the binary tree
  • curnode — the variable is for iteration inside of the binary tree

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jerry An

Jerry An

Golang/Python developer and Technical Writer with a passion for open-source. To support me join Medium: https://jerryan.medium.com/membership