Add Q2 answer

Please review, thanks!
Also, I tried to fully conform to the style guide, please let me know if there's anything I'm missing.
Generally I don't prefer var named 'tmp'; it's too general and vague. I'd encourage to change them to more meaningful names. For example in this function new_node would be is more readable.