title: Is it possible to make a binary tree without OOP in Python?
body: <p>What I mean by OOP is basically the use of Class Node and stuff like this <a href="http://www.geeksforgeeks.org/inorder-tree-traversal-without-recursion/" rel="nofollow noreferrer">http://www.geeksforgeeks.org/inorder-tree-traversal-without-recursion/</a></p>
  
  <p>I've searched for this but I only found how to iterate through a binary tree with non-recursive methods. So now I'm doubting about if a binary tree can be done without objetcs in Python.
  One approach I tested was to create multiple nested lists, where each item was a node, and each item inside the node was another list (or node). Something like this:</p>
  
  <pre><code>t = [[root], [left], [right]]
  </code></pre>
  
  <p>Now I can append the other nodes to each one of these nodes</p>
  
  <pre><code>t[0][0].append(t2)
  t[0][1].append(t3)
  </code></pre>
  
  <p>But I would have to guess how many dimensions will the tree have and I would end up with something like t[0][0][0][0][0][0][0][0][0] to get the data from certain node. I don't know how to do that, and I'm a total noob on Python. I'm used to C, but I have to help someone with their assingment, and they don't know OOP. Will they have to just learn OOP or is there another way to implement a binary tree in Python?</p>