- 博客(211)
- 资源 (17)
- 收藏
- 关注
原创 跟我学storm教程2-并行机制及数据流分组
topology的四个组成部分Nodes(服务器)即为storm集群中的supervisor,会执行topology的一部分运算,一个storm集群一般会有多个nodeworkers(JVM虚拟机)node节点上运行的相互独立的jvm进程,每个节点上可以运行一个或者多个worker。一个复杂的topology会分配到多个worker上运行。Executor(线程)指某个jvm进程中运行的j
2017-05-02 21:09:41
1185
原创 跟我学storm教程1-基本组件及分布式wordCount
storm拓扑组成结构 storm的分布式计算拓扑结果英文为topology,由数据流(stream)、数据源(spout)、运算单元(bolt)三个部分组成。数据源的数据流(stream)按照一定的方式(是否分组等等,这个概念后续会讲)流入一级bolt做运算,之后这些一级bolt的输出再按照一定的方式流入下一级bolt,如下图所示。storm跟hadoop等离线批量计算框架的最
2017-05-01 17:14:49
1423
原创 连接github Permission denied (publickey).解决
连接github Permission denied (publickey).解决本地配置生成ssh-key1、ssh-keygen -t rsa -b 4096 -C wlazjr@gmail.comEnter file in which to save the key 2、设置id名称(/Users/hostName/.ssh/id_rsa): id_xxx3、输入密码Enter pa
2017-05-01 15:17:13
2165
原创 python-2.7.11 already installed, it's just not linked解决办法
通过brew安装python失败,提示:sudo brew install pythonPassword:Warning: python-2.7.11 already installed, it's just not linked解决办法:sudo brew link --overwrite python
2016-07-25 09:16:19
4928
原创 【leetCode】House Robber II python实现
原题链接House Robber II实现原理解析 该题在House Robber的基础上让首位链接形成环,那么即表示第一个和最后一个不能同时被抢,则问题分解为House Robber(nums[0:len(nums)-1])和House Robber(nums[1:len(nums)]),两者中比较大的那个即为结果python代码实现class Solution(object): d
2016-06-19 21:25:46
1341
原创 【leetCode】House Robber python实现
House Robber原题链接House Robber实现原理解析 动态规划实现python代码实现class Solution(object): def rob(self, nums): """ :type nums: List[int] :rtype: int """ if len(nums) ==
2016-06-19 02:20:41
947
原创 【leetCode】Binary Tree Level Order Traversal python实现
Binary Tree Level Order Traversal原题链接Binary Tree Level Order Traversal实现原理解析 层次遍历即可python代码实现class Solution(object): def __init__(self): self.result = [] def levelOrder(self, root):
2016-06-19 01:41:14
1066
原创 【leetCode】Binary Tree Zigzag Level Order Traversal python实现
Binary Tree Zigzag Level Order Traversal原题链接Binary Tree Zigzag Level Order Traversal实现原理解析 层次遍历即可,对于偶数层的做反向python代码实现import copy# Definition for a binary tree node.# class TreeNode(object):# d
2016-06-19 01:18:58
1310
原创 【leetCode】Sum Root to Leaf Number python实现
Sum Root to Leaf Numbers原题链接Path Sum II实现原理解析 该题使用深度搜索找到所有路径,然后把每个路径下的数加起来即可python代码实现import copyclass Solution(object): def __init__(self): self.paths = [] self.path = []
2016-06-18 22:40:32
553
原创 【leetCode】Path Sum II python实现
Path Sum II原题链接Path Sum II实现原理解析 该题使用深度搜索实现即可python代码实现import copy# Definition for a binary tree node.# class TreeNode(object):# def __init__(self, x):# self.val = x# self.le
2016-06-18 21:54:06
1635
原创 【contains-duplicate】leetCode python实现
原题链接contains-duplicate实现原理解析 该题比较简单,比较去重后的长度和原始长度是否一致即可python代码实现class Solution(object): def containsDuplicate(self, nums): """ :type nums: List[int] :rtype: bool
2016-06-18 17:16:09
647
原创 【leetCode】 Balanced Binary Tree python版实现
原题链接Balanced Binary Tree实现原理解析 该题比较简单,主要思想是递归的判断左右子树的高度不大于1即可,注意异常处理python代码实现class Solution(object): def isBalanced(self, root): """ :type root: TreeNode :rtype: bool
2016-06-18 16:56:00
1410
原创 Climbing Stairs
题目:You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?思路:爬楼梯的问题,斐波那契数列,应该见过很多回了
2014-12-01 23:48:41
614
原创 Plus One
题目:Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.思路:简单的大数加法class
2014-12-01 23:35:01
552
原创 Valid Palindrome
code:class Solution: # @param s, a string # @return a boolean def isPalindrome(self, s): zheng = '' fan = '' for i in s: if (i >= 'a' and i = 'A' and
2014-12-01 21:59:26
553
原创 Find Minimum in Rotated Sorted Array
Find Minimum in Rotated Sorted Array
2014-12-01 21:04:53
724
原创 Python的异常处理
Python中的异常类型分如下几种:1、NameError:尝试访问一个未申明的变量>>> vNameError: name 'v' is not defined2、ZeroDivisionError:除数为0>>> v = 1/0ZeroDivisionError: int division or modulo by zero3、Synt
2014-11-29 22:03:13
914
原创 Python多线程
首先看一个简单的没有线程支持的情况下的顺序执行:from time import sleep, ctimedef loop0(): print('start loop 0 at:', ctime()) sleep(4) print('loop 0 done at:', ctime())def loop1(): print('start loop 1
2014-11-29 21:39:52
1193
原创 Python 列表元素去重的3种方法
以前面试的时候遇到过这个问题,今天闲着整理了以下,大概想到以下三种方法。class delect_duplicate: def method_set(self,mlist): print("method_set is called") print("before process mlist is", mlist) l2 = set
2014-11-29 17:07:06
2373
原创 C++ string类的简单实现
#include #include using namespace std;class String{public: String(const char* str = NULL); String(const String &other); String & operator=(const String &other); ~String();protected:privat
2014-10-14 20:19:17
1000
原创 Path Sum
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:Given the below binary tree and sum
2014-10-05 23:17:58
800
原创 Populating Next Right Pointers in Each Node II
Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous solution still work?Note:You may only use constant extr
2014-10-05 22:12:22
711
原创 Binary Tree Level Order Traversal II
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For example:Given binary tree {3,9,20,#,#,15,7},
2014-10-05 21:18:11
933
原创 Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.点击打开原题链接这个题剑指offer里也有,简单的递归即可,代码很清晰:
2014-10-05 20:30:44
802
原创 4Sum_leetCode
Given an array S of n integers, are there elements a,b, c, and d in S such that a + b +c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note:Elements
2014-10-05 16:34:48
776
原创 Merge Sorted Array
Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or equal to m +n) to hold additional elements from B
2014-10-05 16:16:25
482
原创 Subsets
Given a set of distinct integers, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets.For example,I
2014-10-03 19:56:11
924
原创 Unique Paths
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the bo
2014-10-03 14:16:28
643
原创 Decode Ways
//下述算法应该是对的,不过超时// class Solution // {// public:// int numDecodings(string s) // {// if (s.length() == 0)// {// return 0;// }// else if (s.length() == 1)// {// if (s ==
2014-10-03 12:53:14
741
原创 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 level).For example:Given binary tree {3,9,20,#,#,15,7}, 3 / \ 9 20 /
2014-10-03 10:52:08
535
原创 Remove Duplicates from Sorted List II
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinct numbers from the original list.For example,Given 1->2->3->3->4->4->5, return 1->2->5.Given 1->1->
2014-09-29 20:10:54
757
原创 Remove Duplicates from Sorted Array II
Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array A = [1,1,1,2,2,3],Your function should return length = 5, and A is now [1,1,2,2,3]
2014-09-29 19:11:47
482
原创 Sqrt(x)
Implement int sqrt(int x).Compute and return the square root of x.原题链接
2014-09-29 18:43:04
575
原创 Evaluate Reverse Polish Notation
Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: ["2", "1", "+",
2014-09-29 16:48:57
478
原创 Reverse Words in a String
Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".Clarification:What constitutes a word?A sequence of non-space ch
2014-09-29 16:15:36
650
原创 快速排序简单实现
快速排序是C.R.A.Hoare于1962年提出的一种划分交换排序。它采用了一种分治的策略,通常称其为分治法(Divide-and-ConquerMethod)。该方法的基本思想是:1.先从数列中取出一个数作为基准数。2.分区过程,将比这个数大的数全放到它的右边,小于或等于它的数全放到它的左边。3.再对左右区间重复第二步,直到各区间只有一个数。 虽然快速排序称为分治法,但分
2014-08-21 13:57:49
907
转载 ORACLE用户介绍
ORACLE用户介绍昨天朋友在群里询问,EMPLOREE这张表在那里,,怎么查询不到,,,,后面告诉他,不同的表属于不同的用户,要查看表,最好是先用该用户登入进去,,或者是 用户.表名 ,朋友用SCOTT用户登入,,,而那张表是在HR用户下,所以,结果显而易见帮朋友解决问题的同时,,顺便复习了一下ORACLE的用户知识,,,,要知道,ORACLE10G里面有很多默认帐户,一些是系统本身
2014-05-08 02:09:22
2542
android触摸位置显示
2014-02-13
-LPC1788-SDK Example V1.0 Beta version LPC1788例程
2013-08-23
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人