Tag Archives: BST

Find Mode in Binary Search Tree
Leave a commentJune 21, 2017 by oneOokay
Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in the given …
Continue reading 
Delete Node in a BST
Leave a commentFebruary 17, 2017 by oneOokay
Given a root node reference of a BST and a key, delete the node with the given key in the …
Continue reading 
Largest BST Subtree
Leave a commentDecember 1, 2016 by oneOokay
Given a binary tree, find the largest subtree which is a Binary Search Tree (BST), where largest means subtree with …
Continue reading 
Validate Binary Search Tree
Leave a commentNovember 30, 2016 by oneOokay
Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as …
Continue reading 
Lowest Common Ancestor of a Binary Search Tree
Leave a commentNovember 20, 2016 by oneOokay
Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. 适用于所有binary …
Continue reading 
Binary Tree Inorder Traversal
Leave a commentNovember 6, 2016 by oneOokay
Nonrecursive: 一个while loop搞定：得背下来吧。 public List inorderTraversal(TreeNode root) { List ans = new ArrayList(); if (root == null){ return ans; } …
Continue reading