自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(30)
  • 收藏
  • 关注

转载 Hadoop的Map-side join和Reduce-side join

Hadoop中连接(join)操作很常见,Hadoop“连接”的概念本身,和SQL的“连接”是一致的。SQL的连接,在维基百科中已经说得非常清楚。比如dataset A是关于用户个人信息的,key是用户id,value是用户姓名等等个人信息;dataset B是关于用户交易记录的,key是用户id,value是用户的交易历史等信息。我们当然可以对这两者以共同键用户id为基准来连接两边的数据。首先,

2017-12-11 17:21:37 1531

原创 Centos7免密登陆配置

远程登陆配置1.生成公钥和密钥ssh-keygen 对于需要输入的部分可直接回车,公钥存储在/root/.ssh/id_rsa.pub,密钥存储在/root/.ssh/id_rsa2.在centos7最小化安装下,系统缺少spawn命令,使用如下命令安装:yum -y install expect3.运行shell脚本将公钥拷贝到需要免密登陆的主机#!/bin/bashSERVERS="192

2017-09-04 20:57:28 551

原创 Centos7最小化安装下安装MySQL(5.5.48-rpm方式)

1.下载MySQLrpm包wget http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-5.5.48-1.linux2.6.x86_64.rpm-bundle.tar在centos7最小化中缺少wget命令组件,可用如下命令安装 yum -y install wget2.解压安装包到相应路径 tar -zxvf MySQL-5.5.48-1.linu

2017-08-27 16:06:13 2711 1

原创 LeetCode--112. 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 = 2

2017-07-13 10:24:02 240

原创 LeetCode--111. 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.代码:/** * Definition for a binary tree node

2017-07-06 14:25:00 197

原创 LeetCode--104. 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./** * Definition for a binary tree node.

2017-07-05 16:29:20 206

原创 梯度下降算法及Python实现

梯度下降是一个用来求函数最小值的算法,其背后的思想是:开始时我们随机选择一个参数的组合,计算代价函数,然后我们寻找下一个能让代价函数值下降最多的参数组合。我们持续这么做直到到达一个局部最小值,因为我们并没有尝试完所有的参数组合,所以不能确定我们得到的局部最小值是否便是全局最小值,选择不同的初始参数组合可能会得到不同的局部最小值。 定义代价函数(cost function): 梯度下降算法如下

2017-07-05 14:29:02 801

原创 LeetCode--100. 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. 代码:/** * Definit

2017-07-04 10:34:49 189

转载 Linux命令--cd

cd命令用来切换工作目录至dirname。 其中dirName表示法可为绝对路径或相对路径。若目录名称省略,则变换至使用者的home directory(也就是刚login时所在的目录)。另外,~也表示为home directory的意思,.则是表示目前所在的目录,..则表示目前目录位置的上一层目录。 语法cd (选项) (参数) 选项-p 如果要切换到的目标目录是一个符号连接,

2017-07-04 10:25:28 315

转载 Linux命令--ls

ls命令用来显示目标列表,在Linux中是使用率较高的命令。ls命令的输出信息可以进行彩色加亮显示,以分区不同类型的文件。 语法ls(选项)(参数) 选项-a:显示所有档案及目录(ls内定将档案名或目录名称为“.”的视为影藏,不会列出);-A:显示除影藏文件“.”和“..”以外的所有文件列表;-C:多列显示输出结果。这是默认选项;-l:与“-C”选项功能相反,所有输出信息用单列

2017-07-03 13:44:58 192

原创 LeetCode--77. 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],]解决代码:clas

2017-07-03 08:19:34 159

原创 LeetCode--52. N-Queens II

Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.解决方法:class Solution {public: int totalNQueens(int n) { int count

2017-07-03 08:15:56 197

原创 LeetCode--216. Combination Sum III

Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers.Example 1:Input: k = 3, n =

2017-07-03 08:02:21 155

原创 LeetCode--51. N-Queens

The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return all distinct solutions to the n-queens puzzle.Each s

2017-06-27 10:12:24 181

原创 LeetCode--47. 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], [2,1,1]]解决代码

2017-06-26 08:47:17 211

原创 LeetCode--46. Permutations

Given a collection of distinct 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], [3,2,1]]解题代码:c

2017-06-21 19:49:55 165

原创 LeetCode--40. Combination Sum II

Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.Each number in C may only be used once in the combination.No

2017-06-20 10:01:17 179

转载 Backtracking回溯法(又称DFS,递归)全解

回溯是啥用爬山来比喻回溯,好比从山脚下找一条爬上山顶的路,起初有好几条道可走,当选择一条道走到某处时,又有几条岔道可供选择,只能选择其中一条道往前走,若能这样子顺利爬上山顶则罢了,否则走到一条绝路上时,只好返回到最近的一个路口,重新选择另一条没走过的道往前走。如果该路口的所有路都走不通,只得从该路口继续回返。照此规则走下去,要么找到一条到达山顶的路,要么最终试过所有可能的道,无法到达山顶。 回溯是

2017-06-19 10:39:05 1260

原创 LeetCode--4. Median of Two Sorted Arrays

4. Median of Two Sorted ArraysThere are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).E

2017-04-27 08:05:51 214

原创 Python时间处理

1.带日期文件读取2.时间重采样3.时间运算4.时间字符串转换

2017-04-12 19:39:52 4104

翻译 Python时间序列分析--从线性模型到GARCH模型

四级渣渣看个英文文章简直就是自虐,一天只能看一点,还只能看个半懂。唉,写下来以后慢慢理解改正吧。目录一、Motivation 二、基础知识 1.平稳性 2.序列相关(自相关) 3.为什么我们关心序列相关性? 三、白噪声和随机游动 四、线性模型 五、对数线性模型 六、AR模型(P) 七、移动平均模型MA(q) 八、自回归滑动平均模型ARMA(p,

2017-02-28 17:05:18 37983 7

原创 Python数据加载、存储与文件格式

数据加载、存储与文件格式1.读写文本格式数据Pandas中的解析函数: read_csv 从文件、URL、文件型对象中加载带分隔符的数据,默认分隔符为逗号 read_table 从文件、URL、文件型对象中加载带分隔符的数据,默认分隔符为制表符 read_fwf 读取定宽列格式数据(即没有分隔符) read_clipboard 读取剪贴板中的数据,将网页转换为表格时很有用 read_c

2017-02-26 14:02:54 606

原创 Python之pandas基础

Pandas 是基于 Numpy 构建的含有更高级数据结构和工具的数据分析包,类似于 Numpy 的核心是 ndarray,pandas 的两个主要数据结构是 Series 和 DataFrame 。from pandas import Series, DataFrameimport pandas as pdimport numpy as npSeries是一种类似与一维数组的对象,由一组数据以及与

2017-02-25 18:19:21 319

原创 Python基础

第2章 变量和简单数据类型2.3 字符串 1.修改字符串的大小写 title() 首字母大写 upper() 全大写 lower() 全小写name = "ada lovelace"print(name.title())name = name.title()print(name)name = "Ada Lovelace"print(name.upper())print(name.

2017-02-25 15:01:55 253

原创 LeetCode--328.Odd Even Linked List

328. Odd Even Linked ListGiven a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the n

2016-12-08 20:24:58 161

原创 LeetCode--2. Add Two Numbers

2. Add Two NumbersYou are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and

2016-12-06 19:46:40 194

原创 LeetCode--1. Two Sum

1.Two SumGiven an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution.Example:

2016-12-04 20:24:31 166

转载 hash_map/unordered_map原理和使用

转载地址:http://blog.csdn.net/blues1021/article/details/450541591.结论运行效率方面:unordered_map最高,hash_map其次,而map效率最低单提供了有序的序列。占用内存方面:hash_map内存占用最低,unordered_map其次(数量少时优于hash_map),而map占用最高。需

2016-12-04 12:58:04 644

原创 HDU 4791 Alice’s Print Service

题目:Alice’s Print ServiceTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1596    Accepted Submission(s): 380Problem Descripti

2016-10-15 17:54:20 297

原创 大数相加问题

#include "stdafx.h"#include #include using namespace std;int main() { string s1, s2, ss1 , ss2; cin >> s1 >> s2; int n = s1.size(); //逆置字符串 int m = s2.size(); for (int i =

2016-10-14 20:28:25 173

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除