code: def construct_tree_util(
      pre: list, post: list, low: int, high: int, size: int
  ):
      """
      Recursive function that constructs tree from preorder and postorder array.
  
      preIndex is a global variable that keeps track of the index in preorder
      array.
      preorder and postorder array are represented are pre[] and post[] respectively.
      low and high are the indices for the postorder array.
      """
  
      global pre_index
  
      if pre_index == -1:
          pre_index = 0
  
      # Base case
      if pre_index >= size or low > high:
          return None
  
      root = TreeNode(pre[pre_index])
      pre_index += 1
  
      # If only one element in the subarray return root
      if low == high or pre_index >= size:
          return root
  
      # Find the next element of pre[] in post[]
      i = low
      while i <= high:
          if pre[pre_index] == post[i]:
              break
  
          i += 1
  
      # Use index of element present in postorder to divide postorder array
      # to two parts: left subtree and right subtree
      if i <= high:
          root.left = construct_tree_util(pre, post, low, i, size)
          root.right = construct_tree_util(pre, post, i + 1, high, size)
  
      return root
  
label_desc: Use image node_id 1 for calling a global function with example usage: construct_tree_util(pre, post, low, high, size) and returns: root, None, root