摘要: https://leetcode.com/problems/count complete tree nodes/ Given a complete binary tree, count the number of nodes. Definition of a complete binary tree 阅读全文
posted @ 2016-11-09 09:45 BinWone 阅读(99) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/lowest common ancestor of a binary tree/ Given a binary tree, find the lowest common ancestor (LCA) of two given nodes i 阅读全文
posted @ 2016-11-08 22:09 BinWone 阅读(146) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/lowest common ancestor of a binary search tree/ Given a binary search tree (BST), find the lowest common ancestor (LCA) 阅读全文
posted @ 2016-11-08 22:07 BinWone 阅读(136) 评论(0) 推荐(0) 编辑
摘要: "102. Binary Tree Level Order Traversal" Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by 阅读全文
posted @ 2016-11-08 22:05 BinWone 阅读(111) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/sum of left leaves/ Find the sum of all left leaves in a given binary tree. Example: There are two left leaves in the bi 阅读全文
posted @ 2016-11-08 22:04 BinWone 阅读(276) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/binary tree paths/ Given a binary tree, return all root to leaf paths. For example, given the following binary tree: 1 / 阅读全文
posted @ 2016-11-08 21:59 BinWone 阅读(113) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/balanced binary tree/ Given a binary tree, determine if it is height balanced. For this problem, a height balanced binar 阅读全文
posted @ 2016-11-08 21:58 BinWone 阅读(130) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/binary search tree iterator/ Implement an iterator over a binary search tree (BST). Your iterator will be initialized wi 阅读全文
posted @ 2016-11-08 21:54 BinWone 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 排序 参考资料: "经典排序算法总结与实现" 1.快速排序 Python def quick_sort(ary): return qsort(ary,0,len(ary) 1) def qsort(ary,left,right): 快排函数,ary为待排序数组,left为待排序的左边界,right为 阅读全文
posted @ 2016-11-08 09:52 BinWone 阅读(244) 评论(0) 推荐(0) 编辑
摘要: Python 问题集 1.使用try...except...语句捕获异常时应尽量指定异常的具体类型。 2.format输出百分数的形式: format(4.2/5.1,'.2%’) 82.35% 3.使用 会返回一个 的类型, 可以使用两个 相加的方法。 4.Python文件读写: 只读, 只写, 阅读全文
posted @ 2016-11-08 09:48 BinWone 阅读(251) 评论(0) 推荐(0) 编辑