摘要: Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value./** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * ... 阅读全文
posted @ 2013-04-16 18:19 冰点猎手 阅读(111) 评论(0) 推荐(0)
摘要: Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the node's key.The right subtree of a node contains only nodes with keys greater than the node's key.Both the left an 阅读全文
posted @ 2013-04-16 18:06 冰点猎手 阅读(137) 评论(0) 推荐(0)