Write Algorithm For Depth And Height