Tag Archives: BST

  1. Find Mode in Binary Search Tree

    Leave a comment

    June 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

  2. Delete Node in a BST

    Leave a comment

    February 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

  3. Largest BST Subtree

    Leave a comment

    December 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

  4. Validate Binary Search Tree

    Leave a comment

    November 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

  5. Lowest Common Ancestor of a Binary Search Tree

    Leave a comment

    November 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

  6. Binary Tree Inorder Traversal

    Leave a comment

    November 6, 2016 by oneOokay

    Non-recursive: 一个while loop搞定:得背下来吧。  public List inorderTraversal(TreeNode root) { List ans = new ArrayList(); if (root == null){ return ans; } …
    Continue reading