摘要: 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) 编辑
摘要: 树的遍历 1.前序遍历(preoOrder) https://leetcode.com/problems/binary tree preorder traversal/ 2.中序遍历(inOrder) https://leetcode.com/problems/binary tree inorder 阅读全文
posted @ 2016-11-08 09:46 BinWone 阅读(762) 评论(0) 推荐(0) 编辑
摘要: 标准的 SQL 的解析顺序为: (1).FROM 子句, 组装来自不同数据源的数据 (2).WHERE 子句, 基于指定的条件对记录进行筛选 (3).GROUP BY 子句, 将数据划分为多个分组 (4).使用聚合函数进行计算 (5).使用 HAVING 子句筛选分组 (6).计算所有的表达式 (7 阅读全文
posted @ 2016-11-08 09:44 BinWone 阅读(176) 评论(0) 推荐(0) 编辑
摘要: vim记不住命令 1.查找替换 指的是范围, 指从第一行至第七行, 指從第一行至最後一行,也就是整篇文章,也可以 代表。 是目前編輯的文章, 是前一次編輯的文章。 就是要被替換掉的字串,可以用 regexp 來表示。 將 pattern 由 string 所取代。 confirm,每次替換前會詢問。 阅读全文
posted @ 2016-11-08 09:42 BinWone 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 无监督学习(unsupervised learning) 没有已知标签的训练集,只给一堆数据集,通过学习去发现数据内在的性质及规律。 K Means聚类算法步骤 1. 随机取k个样本作为初始均值向量(或者采用别的方式获取初始均值向量); 2. 根据每个样本与均值向量的距离来判断各个样本所属的蔟。 3 阅读全文
posted @ 2016-11-08 09:39 BinWone 阅读(11407) 评论(0) 推荐(0) 编辑