摘要: Q: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 keysless thanthe node's key.The right subtree of a node contains only nodes with keysgreater thanthe node's key.Both the left and 阅读全文
posted @ 2013-05-30 18:22 summer_zhou 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Q: Given a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).For example:Given binary tree{3,9,20,#,#,15,7}, 3 / \ 9 20 / \ 15 7return its zigzag level order traversal as:[ [3... 阅读全文
posted @ 2013-05-30 16:24 summer_zhou 阅读(178) 评论(0) 推荐(0) 编辑