11 2016 档案

摘要:"101. Symmetric Tree" 判断一棵二叉树是不是镜像对称的。 Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, thi 阅读全文
posted @ 2016-11-30 13:03 BinWone 阅读(382) 评论(0) 推荐(0)
摘要:题意 输入两棵二叉树A和B,判断B是不是A的子结构。 Solution 阅读全文
posted @ 2016-11-30 10:26 BinWone 阅读(371) 评论(0) 推荐(0)
摘要:合并两个已排序的链表。 https://leetcode.com/problems/merge two sorted lists/ Merge two sorted linked lists and return it as a new list. The new list should be ma 阅读全文
posted @ 2016-11-29 19:21 BinWone 阅读(145) 评论(0) 推荐(0)
摘要:两个链表反转问题。 "206. Reverse Linked List" Reverse a singly linked list. Hint: A linked list can be reversed either iteratively or recursively. Could you im 阅读全文
posted @ 2016-11-29 16:16 BinWone 阅读(184) 评论(0) 推荐(0)
摘要:两个全排列问题。 "46. Permutations" Given a collection of distinct numbers, return all possible permutations. For example, [1,2,3] have the following permutat 阅读全文
posted @ 2016-11-28 16:28 BinWone 阅读(147) 评论(0) 推荐(0)
摘要:who 显示在线登陆用户 whoami 显示当前操作用户 hostname 显示主机名 uname 显示系统信息 top 动态显示当前耗费资源最多进程信息 ps 显示瞬间进程状态 ps aux du 查看目录大小 du h /home带有单位显示目录信息 df 查看磁盘大小 df h 带有单位显示磁 阅读全文
posted @ 2016-11-27 15:21 BinWone 阅读(149) 评论(0) 推荐(0)
摘要:系统快捷键 将指定区域/整个屏幕截图保存到粘贴板 将指定区域/整个屏幕截图保存到桌面 退出程序 关闭窗口 新建窗口 移到废纸篓 无格式粘贴 切换标签页 全屏 Chrome快捷键 重新打开关闭的网页 向前(后)切换标签页 阅读全文
posted @ 2016-11-27 11:36 BinWone 阅读(197) 评论(0) 推荐(0)
摘要:参考资料 1. "常用 Git 命令清单" 2. "Git常用命令备忘" 阅读全文
posted @ 2016-11-27 11:25 BinWone 阅读(134) 评论(0) 推荐(0)
摘要:好处:如可以方便的直接将字符串形式的list,tuple转换成Python 中的list,tuple。 具体见参考资料。 参考资料 "Be careful with exec and eval in Python" 阅读全文
posted @ 2016-11-26 23:00 BinWone 阅读(1909) 评论(0) 推荐(0)
摘要:登录 其中, 和`pwd`分别代表学号和密码。 登出 或者输错密码或学号登陆失败直接退出登陆。 参考资料 1. "curl命令登录校园网关" 2. "curl 指令小结" 3. "curl网站开发指南" 阅读全文
posted @ 2016-11-24 20:42 BinWone 阅读(1713) 评论(0) 推荐(0)
摘要:Linux的查找命令有5个,分别如下: :在PATH变量指定的路径中,搜索某个系统命令的位置,并且返回第一个搜索结果; :用于区分某个命令到底是由shell自带的,还是由shell外部的独立二进制文件提供的。如果一个命令是外部命令,那么使用 参数,会显示该命令的路径,相当于 命令。type命令其实不 阅读全文
posted @ 2016-11-24 16:10 BinWone 阅读(255) 评论(0) 推荐(0)
摘要:Mac os 英文版下Sublime Text 3中文乱码问题 : install package 安装 ,`Codecs33 gbk` 三个包。 参考: http://ju.outofmemory.cn/entry/219849 阅读全文
posted @ 2016-11-23 21:13 BinWone 阅读(132) 评论(0) 推荐(0)
摘要:在Linux系统下,有很多命令可以查看文本文件的内容,如 等命令,当然还有 等文本编辑器。 cat: 从第一行开始显示全部的文本内容; tac: 从最后一行开始,显示全部分文本内容,与cat相反; nl: 显示文本时,可以输出行号; more: 按页显示文本内容; less: 与more差不多,也是 阅读全文
posted @ 2016-11-23 20:23 BinWone 阅读(1855) 评论(0) 推荐(0)
摘要:参考资料 1. "Mastering Markdown" 2. "在stackoverflow上使用markdown" 3. "Markdown Cheatsheet" 阅读全文
posted @ 2016-11-23 11:21 BinWone 阅读(107) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/number of 1 bits/ Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known 阅读全文
posted @ 2016-11-21 22:14 BinWone 阅读(110) 评论(0) 推荐(0)
摘要:递归代码简洁。 递归的缺点: 1.递归是函数调用自身,函数调用有时间和空间的消耗:每一次函数调用,都需要在内存栈中分配空间已保存参数,返回地址及临时变量,而且往栈里压入数据和弹出数据都需要时间。 2.递归中有很多计算都是重复的(对存在重叠子问题的情形),从而对性能带来很大影响。比如:计算佩波拉契数列 阅读全文
posted @ 2016-11-21 21:18 BinWone 阅读(350) 评论(0) 推荐(0)
摘要:"153. Find Minimum in Rotated Sorted Array" Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., might become ). Find the 阅读全文
posted @ 2016-11-21 17:11 BinWone 阅读(147) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/rotate list/ Given a list, rotate the list to the right by k places, where k is non negative. For example: Given and k = 阅读全文
posted @ 2016-11-21 17:01 BinWone 阅读(131) 评论(0) 推荐(0)
摘要:1.用两个栈实现队列 "232.Implement Queue using Stacks" Implement the following operations of a queue using stacks. push(x) Push element x to the back of queue. 阅读全文
posted @ 2016-11-20 18:25 BinWone 阅读(123) 评论(0) 推荐(0)
摘要:使用MathJax引擎 输入: 显示:$$x=\frac{ b\pm\sqrt{b^2 4ac}}{2a}$$ 参考资料: 1. "MathJax basic tutorial and quick reference" 2. "Mathjax与LaTex公式简介" 3. "markdown语法之如何 阅读全文
posted @ 2016-11-17 15:13 BinWone 阅读(287) 评论(0) 推荐(0)
摘要:已知先序遍历和中序遍历及已知中序遍历和后序遍历重建二叉树的Python递归和迭代解法 105. Construct Binary Tree from Preorder and Inorder Traversal https://leetcode.com/problems/construct bina 阅读全文
posted @ 2016-11-15 22:13 BinWone 阅读(862) 评论(0) 推荐(0)
摘要:112. Path Sum https://leetcode.com/problems/path sum/ Given a binary tree and a sum, determine if the tree has a root to leaf path such that adding up 阅读全文
posted @ 2016-11-12 10:43 BinWone 阅读(266) 评论(0) 推荐(0)
摘要:96. Unique Binary Search Trees https://leetcode.com/problems/unique binary search trees/ Given n, how many structurally unique BST's (binary search tr 阅读全文
posted @ 2016-11-11 22:16 BinWone 阅读(146) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/kth smallest element in a bst/ Given a binary search tree, write a function kthSmallest to find the kth smallest element 阅读全文
posted @ 2016-11-10 21:20 BinWone 阅读(133) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/validate binary search tree/ Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is d 阅读全文
posted @ 2016-11-10 21:16 BinWone 阅读(116) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/delete node in a bst/ Given a root node reference of a BST and a key, delete the node with the given key in the BST. Ret 阅读全文
posted @ 2016-11-10 20:27 BinWone 阅读(675) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/convert sorted array to binary search tree/ Given an array where elements are sorted in ascending order, convert it to a 阅读全文
posted @ 2016-11-10 19:53 BinWone 阅读(135) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/sum root to leaf numbers/ Given a binary tree containing digits from 0 9 only, each root to leaf path could represent a 阅读全文
posted @ 2016-11-10 16:27 BinWone 阅读(149) 评论(0) 推荐(0)
摘要: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 阅读(108) 评论(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 阅读(164) 评论(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 阅读(147) 评论(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 阅读(116) 评论(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 阅读(287) 评论(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 阅读(117) 评论(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 阅读(137) 评论(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 阅读(118) 评论(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 阅读(249) 评论(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 阅读(262) 评论(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 阅读(771) 评论(0) 推荐(0)
摘要:标准的 SQL 的解析顺序为: (1).FROM 子句, 组装来自不同数据源的数据 (2).WHERE 子句, 基于指定的条件对记录进行筛选 (3).GROUP BY 子句, 将数据划分为多个分组 (4).使用聚合函数进行计算 (5).使用 HAVING 子句筛选分组 (6).计算所有的表达式 (7 阅读全文
posted @ 2016-11-08 09:44 BinWone 阅读(185) 评论(0) 推荐(0)
摘要:vim记不住命令 1.查找替换 指的是范围, 指从第一行至第七行, 指從第一行至最後一行,也就是整篇文章,也可以 代表。 是目前編輯的文章, 是前一次編輯的文章。 就是要被替換掉的字串,可以用 regexp 來表示。 將 pattern 由 string 所取代。 confirm,每次替換前會詢問。 阅读全文
posted @ 2016-11-08 09:42 BinWone 阅读(163) 评论(0) 推荐(0)
摘要:无监督学习(unsupervised learning) 没有已知标签的训练集,只给一堆数据集,通过学习去发现数据内在的性质及规律。 K Means聚类算法步骤 1. 随机取k个样本作为初始均值向量(或者采用别的方式获取初始均值向量); 2. 根据每个样本与均值向量的距离来判断各个样本所属的蔟。 3 阅读全文
posted @ 2016-11-08 09:39 BinWone 阅读(11495) 评论(0) 推荐(0)