You can represent a binary tree in python as a one-dimensional list the exact same way.
For example if you have at tree represented as:
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15]
0 is the root
1 & 2 are the next level
the children of 1 & 2 are [3, 4] and [5, 6]
This corresponds to your formula. For a given node at index i the children of that node are (2*i)+1 (2*i)+2. This is a common way to model a heap. You can read more about how Python uses this in its [heapq library].(https://docs.python.org/3.0/library/heapq.html)
You can use this to traverse the tree in depths with something like:
a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15]
def childNodes(i):
return (2*i)+1, (2*i)+2
def traversed(a, i=0, d = 0):
if i >= len(a):
return
l, r = childNodes(i)
traversed(a, r, d = d+1)
print(" "*d + str(a[i]))
traversed(a, l, d = d+1)
traversed(a)
This Prints
15
6
14
2
13
5
11
0
10
4
9
1
8
3
7