Describe an algorithm to perform depth first (preorder) traversals on a quadtree and implement in python
<p>Let's assume that a given object occupies a 2D space, which can be decomposed into N cells. These N cells can, in turn, be stored in an n X n square matrix M, where n is a power of 2 and n = sqrt(N). If a cell is occupied by any portion of the object, then the corresponding matrix entry M[i][j] = 1, otherwise M[i][j] = 0. Implement an algorithm to perform depth first traversal on quadtree in python
sample input is 
a = [[0, 0, 1, 1], [0, 0, 0, 1], [1, 0, 1, 1], [0, 1, 1, 1]] 
n = MyNode.MyNode(a) #"n" is the root of a quadtree based on "a" 
n.depthFirst() 
output is
P P E F F E F E P E F F F</p>
