Skip to content

Instantly share code, notes, and snippets.

How to: Validate a Binary Search Tree (Java)

Suppose we have the following code with a data structure, TreeNode, and a method, isValidBST.

Definition: A given binary tree T is a valid Binary Search Tree (BST) if and only if:

  1. The left subtree contains only values strictly less than the value in the root node.
  2. The right subtree contains only values strictly greater than the value in the root node.
  3. All subtrees are valid BSTs.
@mwroffo
mwroffo / SimpleHTTPServerWithUpload.py
Created September 27, 2017 21:55 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""