自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(18)
  • 资源 (5)
  • 收藏
  • 关注

原创 递归 循环 比较

算法分析: 循环算法和递归算法 无论时间效率还是空间效率都是前者高。递归算法在运行时,函数调用保存现场、开辟运行资源、返回回收资源都需要耗时。递归算法的参数表面是一个变量,实际上市一个栈。结论1:递归确实是一些复杂的问题处理起来简单明了,但是,就效率而言,递归算法的实现往往比循环算法耗费更多的时间和存储空间,也限制了递归的深度。所以,在具体的实现中,应尽可能把递归算法转换为等价

2014-06-05 09:41:18 1462

原创 leetcode 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],]

2014-05-12 09:46:35 488

原创 leetcode Longest Valid Parentheses

思路://引入一个bool数组flag[], flag[i]标记i位置能不能匹配 //最后统计最长true的长度class Solution {public: //引入一个bool数组flag[], flag[i]标记i位置能不能匹配 //最后统计最长true的长度 int longestValidParentheses(string s) {

2014-05-08 16:46:16 461

转载 leetcode First Missing Positive

思路:虽然不能再另外开辟非常数级的额外空间,但是可以在输入数组上就地进行swap操作。思路:交换数组元素,使得数组中第i位存放数值(i+1)。最后遍历数组,寻找第一个不符合此要求的元素,返回其下标。整个过程需要遍历两次数组,复杂度为O(n)。下图以题目中给出的第二个例子为例,讲解操作过程。int firstMissingPosit

2014-05-08 11:07:20 485

原创 leetcode Palindrome Partitioning II

题目:Given a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning of s.For example, given s = "aab"

2014-05-08 10:21:39 549

原创 hadoop 安装 配置 平台搭建

本平台是基于vmware+Ubuntu的,所以平台搭建基础是vmare上面安装ubuntu系统。系统安装就不在说了。NOTE:每个ubuntu上的用户名必须一致。下面我的用户名为zgw。

2014-05-07 20:25:19 556

原创 leetcode Palindrome Partitioning

Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example, given s = "aab",Return [ ["aa","

2014-05-07 17:06:48 482

原创 leetcode Decode Ways

A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, determine the total nu

2014-05-07 14:05:53 453

原创 leetcode Restore IP Addresses

题目 :Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given "25525511135",return ["255.255.11.135", "255.255.111.35"]. (Or

2014-05-06 17:02:46 481

原创 leetcode 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 word:

2014-05-06 15:23:08 437

原创 leetcode Jump Game

Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine i

2014-05-05 20:04:23 523

原创 leetcode Word Break

分析:题目意思是,给定词典的情况下,看看原字符串能不能全部成功地被给定的词典分割。思路:

2014-05-05 10:41:24 480

转载 leetcode Max Points on a Line

文章摘自:http://blog.csdn.net/doc_sgl/article/details/17103427分析:任意一条直线都可以表述为y = ax + b假设,有两个点(x1,y1), (x2,y2),如果他们都在这条直线上则有y1 = kx1 +by2 = kx2 +b由此可以得到关系,k = (y2-y1)/(x2

2014-05-04 19:54:37 433

原创 leetcode Best Time to Buy and Sell Stock III

Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most two transactions.

2014-05-04 16:03:37 587

原创 leetcode Best Time to Buy and Sell Stock II

分析:题目的意思是整个过程中只能买一只股票然后卖出,也可以不买股票。也就是我们要找到一对最低价和最高价,最低价在最高价前面,以最低价买入股票,以最低价卖出股票。可以买卖多次股票,但是不能连续买股票,也就是说手上最多只能有一只股票(注意:可以在同一天卖出手上的股票然后再买进)

2014-05-04 15:13:15 758

原创 leetcode Best Time to Buy and Sell Stock

题目的意思是整个过程中只能买一只股票然后卖出,也可以不买股票。也就是我们要找到一对最低价和最高价,最低价在最高价前面,以最低价买入股票,以最低价卖出股piao

2014-05-04 14:39:54 600

原创 elasticsearch ik 分词

一、如果只需要将"维基百科"单独分开,只需要做如下处理,      1、确定词典中有“维基”、“百科”这两个词,并且没有“维基百科”这个词      2、ik分词采用智能分词模式,也就是这个ik_smart二、如果需要将"维基百科"分成三个词"维基百科","维基","百科",那么需要做如下处理     1、确保词典中有“维基”、“百科”、"维基百

2014-04-30 14:45:09 808

原创 lucene 并发、锁

1. lucene并发规则任意数量的只读属性Index

2014-04-29 14:31:52 776

ElasticSearchManual

本pdf是elasticsearch开放的必备工具书,里面讲述了elasticsearch的各个api的使用说明,及实例。

2014-04-23

elasticsearch实战

本书是关于elasticsearch的精典书籍,是初学者必看的一本书。里面讲述了es的各个关键技术。

2014-04-23

exploring elasticsearch

本书是es开发的常用参考书籍,里面讲述了es的数据模型,搜索,自然语言处理,搜索结构化的数据等内容

2014-04-23

Mastering ElasticSearch

elasticsearch的电子书,主要介绍了es使用,分布式索引的原理,索引底层控制,JAVA的API使用,插件的部署等。

2014-04-23

空空如也

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

TA关注的人

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