Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@vamsitallapudi
Last active December 23, 2020 03:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vamsitallapudi/1e0703f7b792b47029db099688d9e2ce to your computer and use it in GitHub Desktop.
Save vamsitallapudi/1e0703f7b792b47029db099688d9e2ce to your computer and use it in GitHub Desktop.
class TreeNode(var data: Int, var left: TreeNode? = null, var right: TreeNode? = null)
fun initializeBinaryTree(): TreeNode {
val c = TreeNode(4)
val d = TreeNode(5)
val a = TreeNode(2, c, d)
val b = TreeNode(3)
return TreeNode(1, a, b)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment