Here are some useful code snippets in java using binary trees.