- 博客(103)
- 收藏
- 关注
转载 Larbin简介,及其在Ubuntu10.04下的编译安装
Larbin简介,及其在Ubuntu10.04下的编译安装Larbin是一种多功能的网络爬虫,一个法国人最初为XYLEME project写的,当时只是为了获取网络上的XML文件.Larbin是非常灵活可订制的.最新版本的Larbin在一台普通的PC上一天可爬到5,000,000个网页,当然这很大程序上依赖于你的网速.Larbin工作于linux上,并且依赖于一些标准库,比如adns.
2014-07-08 18:22:19
1021
转载 Linux系统下安装中文输入法 fcitx
fctix输入法安装sudo apt-get -y remove ibussudo apt-get -y remove scimsudo apt-get -y install fcitxim-switch -s fcitx -z defaultmkdir ~/.fcitxfcitx 安装后显示方格乱码,是因为没有指定相应的系统已有字体用命令 fc
2014-04-28 14:21:05
1297
原创 Valid Parentheses
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are all va
2014-01-20 21:44:48
975
原创 Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target, whe
2014-01-20 21:26:24
954
原创 Longest Consecutive Sequence
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest consecutive elements sequence is [1, 2, 3
2014-01-17 00:02:12
1015
原创 数字在排序数组中出现的次数
// 利用二分查找,找到之后再分别利用二分查找,找出第一次出现的位置和最后一次出现的位置#include#include#includeusing namespace std;int* findFirst(int * arr, int size, int target) { if (arr == NULL || size <= 0) { return NULL;
2013-11-06 21:13:59
892
原创 Python
1. 参数收集器 (*vars, **vs) *vars 收集 a,b,c这样的多个变量元组 vars = (a, b, c) **vs收集a=1, b=2, c=3这样的key-value对, vs = {a:1, b:2, c:3}2. for var1, var2 in zip(tuple, list): 并列地从tuple 和list 中各取一个元素, 相当于两个维度的变量。
2013-11-03 23:09:25
982
原创 Effective C++读书笔记
【条款01】 视C++为一个语言联邦:① C语言部分 ② Object-Oriented C++ ③ Template C++泛型编程 ④ STL :容器、迭代器、算法、函数对象 高效的传值方式: pass-by-value对于内置类型 和 (迭代器、函数对象)[指针实现]
2013-10-28 01:11:04
1053
翻译 索引布尔表达式 [ Indexing Boolean Expressions ]
摘要1. 引言2. 模型3. DNF算法3.1 倒排表构建3.2 示例3.3 连接词算法3.4 示例4 实验4.1 DNF算法4.1.1 选择性影响4.1.2 高纬影响5. 复杂布尔表达6. 结论
2013-10-04 22:40:58
3107
翻译 PageRank引用排行:让网络变得有序 [ The PageRank Citation Ranking: Bringing Order to the Web ]
The PageRank Citation Ranking: Bringing Order to the Web 摘要1. 引言和动机1.1 网页的多样性1.2 PageRank2. 网络上每个页面的排名2.1 相关工作2.2 网络的链接结构2.3 通过链接传播排行2.4 PageRank的定义2.5 随机冲浪模型2.6 PageRank的计算
2013-10-04 17:18:52
4505
翻译 大规模超文本网络搜索引擎解析 [ The Anatomy of a Large-Scale Hypertextual Web Search Engine ]
The Anatomy of a Large-Scale Hypertextual Web Search Engine Sergey Brin and Lawrence Page {sergey, page}@cs.stanford.edu
2013-10-04 16:39:07
2965
原创 通过虚函数表调用虚函数与通过虚函数表(绕过访问权限控制)
一、背景知识 在讲解虚函数的时候,我们知道,如果类中有虚函数,则该类中存在一个虚函数表(V-Table),每个该类的对象都会有一个指针指向该虚函数表,存储这类中虚函数的函数指针,而虚函数表的地址就存在该类对象内存的开始处,目的是为了方便查找虚函数。 在陈浩的技术专栏中写过一篇对C++虚函数表解析很透彻的的文章: C++ 虚函数表解析
2013-09-22 19:05:38
4176
原创 C++中派生类重写基类重载函数时需要注意的问题:派生类函数屏蔽基类中同名函数
派生类可以继承基类中的非私有函数成员,当然也就可以继承其中非私有的被重载的函数。如下:【参考代码】class Base { public: void print() { cout << "print() in Base." << endl; } void print(int a) { cout << "print(int a) in Base." <<
2013-09-22 19:00:37
10595
1
原创 由C++ STL的vector容器中存储的对象拷贝引起的对capacity属性 的理解
【起因】在测试C++中通过基类引用做形参实现多态的时候,写过一段很挫的测试程序,如下:Base b;Derived1 d1;Derived2 d2;Derived3 d3;vector base_vec;base_vec.push_back(b);base_vec.push_back(d1);base_vec.push_back(d2);base_vec.push_ba
2013-09-22 18:54:49
7229
原创 Sqrt(x)
Implement int sqrt(int x).Compute and return the square root of x.class Solution {public: int sqrt(int x) { // Start typing your C/C++ solution below // DO NOT write int m
2013-08-23 17:02:14
995
原创 Valid Palindrome
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car" is no
2013-08-23 16:26:54
818
原创 Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space.class Solution {public: bool isPalindrome(int x) { // Start typing your C/C++ solution below // DO NOT
2013-08-23 16:02:32
770
原创 Unix文件属性相关系统调用
#include #include #include int stat(const char *path, struct stat *buf); int fstat(int fd, struct stat *buf); int lstat(const char *path, struct stat *bu
2013-08-19 16:00:58
1083
原创 print系列函数(formatted output conversion)
printf, fprintf, sprintf, snprintf, vprintf, vfprintf, vsprintf, vsnprintf #include int printf(const char *format, ...); int fprintf(FILE *stream, const char *forma
2013-08-16 16:30:02
1018
原创 interprocess communication (IPC) 进程间通信
signals, which are used to indicate that an event has occurred;pipes (familiar to shell users as the | operator) andFIFOs, which can be used totransfer data between processes;sockets, which ca
2013-08-14 11:00:50
992
转载 Bash Shell 快捷键的学习使用
Bash Shell 快捷键的学习使用博客分类: linux/unixCTRL 键相关的快捷键:Ctrl + a - Jump to the start of the lineCtrl + b - Move back a charCtrl + c - Terminate the command //用的最多了吧?Ctrl + d - Dele
2013-08-12 10:11:45
1015
原创 Next Permutation
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it as the lowest possible
2013-06-26 18:21:50
1003
原创 Permutation Sequence
The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence (ie, for n = 3):"123""132""213"
2013-06-26 15:24:28
1044
原创 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
2013-06-25 19:10:32
851
原创 Combinations
Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4
2013-06-25 18:15:35
851
原创 Permutations II
Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2] have the following unique permutations:[1,1,2], [1,2,1], and [2,1,1
2013-06-21 12:55:16
1225
原创 Permutations
Given a collection of numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], and [3,2,1].class Solutio
2013-06-19 23:22:59
862
原创 Text Justification
Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.You should pack your words in a greedy approach; that
2013-06-19 16:20:33
1083
原创 Edit Distance
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted on a w
2013-06-17 16:05:01
932
原创 Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array.
2013-06-14 19:08:24
1219
原创 Search in Rotated Sorted Array
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If found in the array ret
2013-06-14 18:49:57
932
原创 4Sum
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:
2013-06-14 18:32:22
890
原创 3Sum Closest
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exa
2013-06-14 17:00:47
809
原创 3Sum
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:Elements in a triplet
2013-06-14 16:33:01
881
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人