Skip to content

Instantly share code, notes, and snippets.

@nuttt
Created February 4, 2015 06:21
Show Gist options
  • Select an option

  • Save nuttt/67003b5e7c7eba133bd7 to your computer and use it in GitHub Desktop.

Select an option

Save nuttt/67003b5e7c7eba133bd7 to your computer and use it in GitHub Desktop.
build a binary tree class (with no repeat element in tree)
with following APIs
- new()
- addnode(int a)
--- return true if a is not already in binary tree
--- otherwise return false
- removenode(int a)
--- return true if a is removed in binary tree
--- return false if otherwise
- depth(int a)
--- return integer repesents depth of a in binary tree
--- return null if a is not in binary tree
- isInBinaryTree(int a)
- preorder()
--- return array of integer representing preorder traversal of tree
- inorder()
- postorder()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment