<jupyter_start><jupyter_text><jupyter_code>class NodoArbol:
  def __init__(self, value, izq=None, der=None):
    self.value=value
    self.left=izq
    self.right=der
class Binario:
  def __init__(self):
    self.root=None
  def insert(self,value):
    if self.__root==None:
      self.__root=NodoArbol(value,None,None)
    else: 
      self.__insert_nodo__(self.__root,value)
  def __insert_nodo__(self,non,value):
    if nodo.value==value:
      pass
    elif value<nodo.value:
      if nodo.left==None:
        nodo.left=NodoArbol(value,None,None)
      else:
        self.__insert_nodo__(nodo.left,value)
    else:
      if nodo.right==None:
        nodo.right=NodoArbol(value,None,None)
      else:
        self.__insert_nodo__(nodo.right,value)
  def Hoja(self):
    return  arbol.left.esvacio and arbol.right.esvacio

  def Nivel (self):
    left = 0
    right = 0

    if Hoja(self):
        value = self.value
        return 1 , value
    else:
        if not self.left.esvacio:
            left,left.value = profundidad(self.left.value)
        if not self.right.esvacio:
            right,right.value = Nivel(self.right) 

        if (izq > der):
            return izq+1,value.left
        else:
            return der+1, value.right
  def __repr__(self):
    if self.esvacio:
      return ""
    elif Hoja(self):
      return "{}".format(self.value)
    else:
      return "{} -> ({}, {})".format(self.value, self.left, self.right)<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup