- 博客(126)
- 收藏
- 关注
原创 hadoop 相关配置(未完成)
1.core-site.xmlfs.default.name:用于指定HDFS的namenode和默认的文件系统。hadoop.tmp.dir:HDFS的存储目录。默认值是/tmp/hadoop-${user.name}.LINUX系统中,在服务重启以后,会把/tmp下的目录清空,所以这个一定要重新配置。配置之后需要格式化namenodeio.file.buff
2014-12-27 21:13:07
686
转载 shell中如何截取字符串(2)
第一种方法:${varible##*string} 从左向右截取最后一个string后的字符串${varible#*string}从左向右截取第一个string后的字符串${varible%%string*}从右向左截取最后一个string后的字符串${varible%string*}从右向左截取第一个string后的字符串"*"只是一个通配符可以不要
2014-11-05 23:15:14
2217
转载 Linux 字典
echo "shell定义字典"#必须先声明declare -A dicdic=([key1]="value1" [key2]="value2" [key3]="value3")#打印指定key的valueecho ${dic["key1"]}#打印所有key值echo ${!dic[*]}#打印所有valueecho ${dic[*]}#遍历key值for key in
2014-11-04 23:24:54
900
转载 C++中getline函数用法
http://blog.youkuaiyun.com/explorewen/article/details/2433164getline() 语法: istream &getline( char *buffer, streamsize num ); istream &getline( char *buffer, streamsize num, char
2014-10-04 21:48:42
808
转载 C++ ofstream和ifstream详细用法
C++ ofstream和ifstream详细用法2010-07-20 00:00 中国IT实验室 佚名 关键字:C++ C语言企业软件热点文章Java调用Dll存在指针或变参的解决方法Oracle中非默认方式创建外键的使用 ofstream是从内存到硬盘,ifstream
2014-10-04 16:32:38
625
转载 Python 深入理解yield
只是粗略的知道yield可以用来为一个函数返回值塞数据,比如下面的例子:def addlist(alist): for i in alist: yield i + 1取出alist的每一项,然后把i + 1塞进去。然后通过调用取出每一项:alist = [1, 2, 3, 4]for x in addlist(alist): pri
2014-10-03 16:59:58
450
转载 ubuntu14.04 chrome显示乱码问题
sudo apt-get install ttf-wqy-microhei ttf-wqy-zenheixfonts-wqy
2014-09-30 22:40:25
716
原创 leetCode:Palindrome Number
Palindrome NumberTotal Accepted: 22288 Total Submissions: 76684 Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could nega
2014-09-25 22:18:54
461
原创 leetCode:ZigZag Conversion
#include#includeusing namespace std;class Solution{public: int convert(string s,int nRows);};int Solution::convert(string s,int nRows){ int length=s.length(); int interval=2*nRows-
2014-09-25 16:06:28
454
转载 leetCode:Longest Palindromic Substring
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length ofS is 1000, and there exists one unique longest palindromic substring#include#includeus
2014-09-25 13:15:13
508
转载 阿克曼函数
维基百科:阿克曼函数http://zh.wikipedia.org/wiki/%E9%98%BF%E5%85%8B%E6%9B%BC%E5%87%BD%E6%95%B8阿克曼函数是非原始递归函数的例子;它需要两个自然数作为输入值,输出一个自然数。它的输出值增长速度非常高,仅是(4,3)的输出已大得不能准确计算。1920年代后期,数学家大卫·希尔伯特的学生Gabriel
2014-09-25 11:51:57
8208
转载 leetCode:Longest Substring Without Repeating Characters
#include#include#includeusing namespace std;class Solution{public: int lengthOfLongestSubstring(string s){ int length=s.size(); map charmap; int maxLen=0,lastindex=-1
2014-09-24 10:39:58
544
原创 leetCode: 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, where
2014-09-22 09:56:02
552
原创 leetCode: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-21 15:16:58
510
原创 字符串操作
自己写的,还有一些不全面#include#includeint StrLength(char[]);int Concat(char* T,char s1[],char s2[]);int Index(char S[],char T[],int pos);char *reverse(char*,int);int main(){ char a1[11]="abcdefghij
2014-09-12 20:23:46
503
原创 leetCode:Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.
2014-09-10 16:34:43
508
原创 leetCode: BInary 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.
2014-09-09 20:20:50
488
原创 Binary Search Tree
#include#include#include#define keytype int#define MAX_NUMBER -999999#define MIN_NUMBER 999999using namespace std;typedef struct BiTNode{ keytype data; struct BiTNode * lchild; struct BiTN
2014-09-09 12:51:22
516
原创 leetCode:Reverse Integer
Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.Have you thought about this?Here are some good questions to ask before coding.
2014-09-08 04:13:56
461
原创 leetCode:Minimum Depth of Binary Tree
Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.
2014-09-08 02:17:03
524
原创 leetCode: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-09-08 00:43:25
542
原创 leetCode:Pascal's Triangle II
#include#includeusing namespace std;class Solution{public: vector generate(int numRows){ vector > temp; if(numRows<=0) return temp[numRows]; for(int i=0;i<numRows+1;i
2014-09-07 21:11:45
485
转载 leetCode:Pascal's Triangle
Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]
2014-09-07 17:33:27
558
转载 VECTOR in C++:二维数组
用vector取代C-style的数组 提起数组,大家想必都很熟悉,你可以用索引和指针来操作数组,给程序设计带来了很大的灵活性。但是你知道它有许多天生的缺陷吗? 首先,数组的越界可能会引起程序的崩溃(如果崩溃了,还算你走运^_^)。其次是动态性不好,包括动态改变大小,动态申请。诸如此类的事,一定会让你伤透脑筋。有什么办法可以解决这些问题吗? 你不用
2014-09-07 16:51:01
898
原创 leetCode:Linked List Cycle II
Given a 2D board containing 'X' and 'O', capture all regions surrounded by'X'.A region is captured by flipping all 'O's into 'X's in that surrounded region.For example,X X X XX O O XX X
2014-09-07 11:35:34
527
转载 n节点组成二叉树的个数
可以分析,当n=1时,只有1个根节点,则只能组成1种形态的二叉树,令n个节点可组成的二叉树数量表示为h(n),则h(1)=1; h(0)=0; 当n=2时,1个根节点固定,还有2-1个节点。这一个节点可以分成(1,0),(0,1)两组。即左边放1个,右边放0个;或者左边放0个,右边放1个。即:h(2)=h(0)*h(1)+h(1)*h(0)=2,则能组成2种形态的二叉
2014-09-07 00:17:24
1373
转载 leetCode: same tree
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.
2014-09-06 23:27:51
443
原创 leetCode:Single Number
Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using extra
2014-09-06 16:14:50
452
原创 leetCode:Binary Tree Postorder Traversal,Binary Tree Preorder Traversal--JAVA version
Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3].
2014-09-06 02:22:04
477
转载 leetcode generate parentheses
pu newstr+=")"; recursive(left, right+1,n, newstr, list); } } public static void main(String[] args){ ArrayList list=new ArrayList(); list=generatePa
2014-09-05 18:48:36
405
原创 leetcode题目:reverse words in a string
public class Solution { public static String reverserWords(String s){ String[] Array=s.split(" "); int len=Array.length;//length of array int low=0;int high=len-1;int i=0; while(i<len && low
2014-09-05 16:13:52
497
原创 HIVE的数据操作
管理表中装载数据1 往表中装载数据的唯一方法是使用一种大量的 数据装载 操作hive >load data local path '${env:HOME}/california-employee' >overwrite into table employee >parition (country='US',state='CA');记住这里的形式load da
2014-09-05 15:26:47
583
原创 HIVE数据库的基本操作
HIVE的特点:HIVE 不支持行级插入操作、更新操作和删除操作 HIVE 不支持事物I 数据库1 创建数据库hive> create database financials;orhive> create database if not exists financials;2 查看包含的数据库hive> show databases;使用正
2014-09-05 00:23:21
2798
1
原创 ubuntu14.04 hadoop在两台电脑上的搭建
hadoop 2.5.0安装目录/usr/local/hadoop-2.5.0首先是ssh localhostPS:1如何出现 ssh : connect to host localhost port 22:Connection 这样命令,那么是ssh server没有启动。安装openssh-server,然后 (sudo) /etc/init.d/ssh -star
2014-09-04 16:49:48
3595
原创 UBUNTU14.04 hadoop搭建的注意事项
hadoop 2.5.0安装目录/usr/local/hadoop-2.5.0首先是ssh localhostPS:1如何出现 ssh : connect to host localhost port 22:Connection 这样命令,那么是ssh server没有启动。安装openssh-server,然后 (sudo) /etc/init.d/ssh -star
2014-09-04 16:48:39
621
转载 R语言 apply函数家族详解
applyApply Functions Over ArrayMargins对阵列行或者列使用函数apply(X, MARGIN, FUN,...)lapplyApply a Function over a Listor Vector对列表或者向量使用函数lapply(X, FUN,...)sapply
2014-09-04 14:51:06
5556
转载 Mysql基本用法
#登录数据库mysql -hlocalhost -uroot -p;#修改密码mysqladmin -uroot -poldpassword new; #显示数据库show databases;#显示数据表show tables;#选择数据库use examples;#创建数据库并设置编码utf-8 多语言create database
2014-09-03 20:19:40
456
原创 ubuntu 下安装 mysql
在Ubuntu上安裝MySQL十分方便,請在終端機輸入下列指令: sudo apt-get install mysql-server mysql-client安裝完後,由於root預設的密碼是空的,為了安全起見,應儘快修改密碼,方法如下: sudo mysqladmin -u root -p 新密碼這時它會問你原來的密碼,只要按Enter即可。 然後重新啟動MySQL:
2014-09-03 20:09:51
420
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人