No the bottom code is not correct. In the bottom implementation what you do is you make the left child node actually the parent node of your class. If the node you are in already is not the root node then the left child is set correctly, but the left child does not get its parent set correctly.
The image below is the result of executing the code on the bottom
The image below is the result of executing the top block (which is correct)