-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Tree
Mission Peace edited this page May 5, 2016
·
11 revisions
- Self balancing tree AVL tree - AVLTree.java
- Given an arbitrary binary tree, convert it to a binary tree that holds Children Sum Property. You can only increment data values in any node - ArbitaryTreeToChildSumTree.java
- Given Preorder traversal of a BST, check if each non-leaf node has only one child. Assume that the BST contains unique entries - BSTOneChildPreOrderTraversal.java
- Btree implementation - BTree.java
- Binary tree operations - BinaryTree.java
- Convert a binary tree to circular link list - BinaryTreeToCircularLinkList.java
- Write a function to connect all the adjacent nodes at the same level in a binary tree - ConnectNodesAtSameLevel.java
- Given two arrays that represent preorder and postorder traversals of a full binary tree, construct the binary tree - ConstructFullTreeFromPreOrderPostOrder.java
- Construct tree from preorder and inorder traversal - ConstructTreeFromInOrderPreOrder.java
- Given inorder and level-order traversals of a Binary Tree, construct the Binary Tree - ConstructTreeFromLevelOrderInOrder.java
- Write a function to count number of smaller elements on right of each element in an array - CountNumberOfSmallerElementOnRight.java
- Given binary tree and two nodes, tell if these two nodes are cousins of each other or not - CousinNodes.java
- Diameter of binary tree - DiameterOfTree.java
- Huffman encoding - HuffmanEncoding.java
- Given two arrays which represent a sequence of keys. Imagine we make a Binary Search Tree (BST) from each array. We need to tell whether two BSTs will be identical or not without actually constructing the tree - IdenticalTrees.java
- Given a binary tree, find largest BST in this binary tree - LargestBSTInBinaryTree.java
- Given a Binary Tree, find size of the Largest Independent Set(LIS) in it. A subset of all tree nodes is an independent set if there is no edge between any two nodes of the subset - LargestIndependentSetInTree.java
- Level order traversal of binary tree - LevelOrderTraversal.java
- Create an iterator to traverse a binary tree. When the next function is called on the binary tree return the value at the next node as if you are doing an inorder traversal of the tree - NextInorderSuccessorIterator.java
- Given a binary tree and a number k, print nodes at distance k from given node - NodesAtDistanceK.java
- Populate inorder successor for all nodes - PopulateInOrderSuccessor.java
- Inorder successor of two tree -NextInorderSucessorOfTwoTree.java
- Given preorder traversal of a binary search tree, construct the BST - ConstructBSTFromPreOrderArray.java
- Print two BST in sorted form - PrintTwoBSTInSortedForm.java
- Given a binary tree and a number, return true if the tree has a root-to-leaf path such that adding up all the values along the path equals the given number - RootToLeafToSum.java
- Range query segment tree - SegmentTree.java segmenttreesum.py
- Segment tree for minimum range query - SegmentTreeMinimumRangeQuery.java
- Given a binary tree with positive and negative numbers, sink negative numbers to the bottom of the tree - SinkNegativeToBottom.java
- Given an array that stores a complete Binary Search Tree, write a function that efficiently prints the given array in ascending order - SortedOrderPrintCompleteTreeArray.java
- Write a function that returns true if the given Binary Tree is SumTree else false. A SumTree is a Binary Tree where the value of a node is equal to sum of the nodes present in its left subtree and right subtree - SumTree.java
- Inorder,preorder,postorder traversals - TreeTraversals.java
- Given a binary tree, print it vertically - VerticalTreePrinting.java
- Given a Binary Search Tree (BST), modify it so that all greater values in the given BST are added to every node - AddGreaterValueNodeToEveryNode.java
- Print all nodes with no sibling - NodesWithNoSibling.java
- Boundary traversal of binary tree - BoundaryTraversal.java
- Convert a binary tree into double link list - BinaryTreeToDoubleLinkList.java
- Given a binary tree, tell if it is a complete tree or not. IsCompleteBinaryTree.java
- Given a preorder traversal of a tree with 0 or 2 children and char array where L stands for leaf node and N stands for inner node, create binary tree from it - ConstructTreeFromPreOrderTraversalWith0or2Child.java
- Convert a binary tree(not BST) to a sorted link list - BinaryTreeToSortedLinkList.java
- Given an inorder traversal of tree where each node is greater than its child nodes, create binary tree - ContructTreeFromInOrderTraversalRootGreaterThanChild.java
- Given two nodes value find lowest common ancestor of these two nodes - LowestCommonAncestorInBinaryTree.java
- Write a function to detect if two trees are isomorphic. Two trees are called isomorphic if one of them can be obtained from other by a series of flips - TreeIsomorphism.java
- Vertex cover for binary tree using DP - VertexCoverBinaryTreeDP.java
- Convert a binary tree(Not BST) to sorted linklist. DegenerateBinaryTreeToSortedLL
- Search in binary search tree - BSTSearch.java
- Given a binary tree, return true if is binary search tree else return false -IsBST.java
- Given two tree return true if they represent same tree else return false. SameTree.java
- Tree traversal in level and spiral order - TreeTraversalInSpiralOrder.java
- Tree traversal printing each level on new line - TreeTraversalLevelByLevel.java
- Level order traversal in reverse - LevelOrderTraversalInReverse.java
- Fenwick tree - FenwickTree.java
- Red black tree - RedBlackTree.java
- Given an preorder sequence determine if it is of binary search tree or not IsPreOrderArrayBST.java
- Succinct encoding/decoding of binary tree SuccinctTree.java
- Create binary tree from parent representation - BinaryTreeFromParentRepresentation.java
- Given pre/inorder traversal of binary tree, create post order traversal - PrintPostOrderFromPreOrderInOrder.java
- Construct all binary search tree from inorder traversal ConstructAllBinaryTreeFromInorderTraversal.java
- Interval tree IntervalTree.java
- Morris inorder/preorder traversal of tree - MorrisTraversal.java
- Serialize deserialize binary tree - SerializeDeserializeBinaryTree.java
- Lowest common ancestor in binary search tree - LowestCommonAncestoryBinarySearchTree.java