Preorder and postorder

the complexity of this code isO(N^2)?

@deepakjumani09 yeah