自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(48)
  • 资源 (2)
  • 收藏
  • 关注

原创 Kafka源码解析(一)core.kafka.server.KafkaServer

简单讲讲kafka的broker启动相关代码。

2017-07-19 15:38:33 2042 2

原创 分布式爬虫架构设计

分布式爬虫架构设计最近又和爬虫干上了,有3000万个搜索关键词,1个关键词搜索结果有多个,每个结果对应一个ID,每个ID的对应的目标页面由多个请求接口返回的json组合而成。1.在架构上使用kafka分发搜索关键词,利用了kafka同一消费组只消费一次的特性。2.利用redis进行id去重。3.在扩展性上利用kafka的consumer balance,实现爬虫进程的可以随时增加减少(当然进程数不应

2017-07-10 13:33:01 2693

原创 线性回归与梯度下降

线性回归与梯度下降现实生活中我们可以通过一个房子的地点、楼层、朝向等信息(在机器学习中称这些信息为feature,特征)估算一个房子的平米价格。估算价格时我们需要知道一些房子的数据,我们凭空去猜一个房子的价格得到准确结果的概率不大。这些我们事先知道的房子数据被称为训练数据。 可以看成我们脑海中有一个函数帮助我们估计结果的值。在计算机中去拟合训练数据,也就说我们通过函数得到的结果不会和实际结果差的太

2017-07-09 13:46:50 424

原创 Flume

Flumeflume是一个分布式日志收集系统。flume的核心是把数据从数据源(source)收集过来,在将收集到的数据送到指定的目的地(sink)。为了保证输送的过程一定成功,在送到目的地(sink)之前,会先缓存数据(channel),待数据真正到达目的地(sink)后,flume再删除自己缓存的数据。 在整个数据的传输的过程中,流动的是event,即事务保证是在event级别进行的。那么什

2017-03-22 11:22:18 461

原创 PageRank

PageRank闲来无事,整理一下算法。今天整理一下PageRank。网上搜了搜感觉这篇文章还不错 http://www.cnblogs.com/fengfenggirl/p/pagerank-introduction.html本文对这篇文章进行修改加工,加入了一些自己的思想,后面代码实现用了spark而不是原文的MR。PageRank作用是给出网页的重要性,它的思想是这样的:根据“民主投票”来确

2017-03-21 22:53:11 444

原创 余弦相似度

余弦相似度基于余弦定理计算相似度的应用很多,比如推荐系统中的协同过滤,计算文本的相似性等等。

2017-03-21 16:06:23 1440

原创 HbaseAPI

简单讲解HBase的java api

2017-03-17 22:28:37 1191

原创 HBase浅谈

简单谈一谈HBase

2017-03-16 22:24:31 399

原创 kerberos工作原理

谈谈kerberos。

2017-03-08 18:01:38 1002

原创 KNN算法

KNN算法

2017-03-03 17:23:19 610

原创 谈谈推荐系统(一)什么是推荐系统

推荐系统以及评估标准

2016-11-04 11:37:32 3927

原创 谈一谈信息熵

(这篇文章是我在微信公众号上发表的一篇文章)这次博主和大家谈一谈信息熵。在大家学习数据挖掘算法中的决策树时,会知道决策树是通过信息熵来判读哪个特征是最适合做当前的根结点的。当然信息熵还可以被应用于压缩领域,通过信息熵可以知道文件的压缩下限。    那么到底什么是信息熵呢?首先提到熵,我们可能想的是在中学时代我们物理中的热力学的一个概念——通过熵来表示不稳定性。香农(本文封面

2016-10-10 16:35:15 2648

原创 HDFS浅谈

最近在做关于HBase的开发,由于HBase是基于HDFS的,所以对这方面进行了学习。下面是总结的思维导图:一、结构hdfs的结构主要分三块:Client,NameNode (NN),DataNode  (DN) Client:客户端,系统使用者,调用HDFS API操作文件;与NN交互获取文件元数据;与DN交互进行数据读写。   Nam

2016-08-16 15:49:45 436

原创 朴素贝叶斯分类

简单介绍朴素贝叶斯分类,和如何计算线性特征的概率

2016-05-17 17:20:27 483

原创 浅谈分类

简单唠唠分类算法、归一化处理、测试和训练,并附上思维导图拙作一副

2016-05-16 17:03:02 433

原创 AES加密算法实现

用java库,scala实现AES算法

2016-05-13 17:24:07 3109

原创 RC4加密算法及其scala实现

最近用到了rc4算法和base64简单写一篇关于rc4的文章。 RC4算法的特点是算法简单,运行速度快,而且密钥长度是可变的,可变范围为1-256字节(8-2048比特),在如今技术支持的前提下,当密钥长度为128比特时,用暴力法搜索密钥已经不太可行,所以可以预见RC4的密钥范围任然可以在今后相当长的时间里抵御暴力搜索密钥的攻击。实际上,如今也没有找到对于128bit密钥长度的RC4加密算法的

2016-05-11 13:11:17 1610

转载 base64

http://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac9270762a000/001399413803339f4bbda5c01fc479cbea98b1387390748000Base64是一种用64个字符来表示任意二进制数据的方法。用记事本打开exe、jpg、pdf这些文件时,我们都会看

2016-05-11 10:17:25 368

原创 协同过滤浅谈

浅谈下协同过滤,其中相似性的计算,k邻域算法,slopone算法,以及显式和隐式、userCF和itemCF的区别与局限性

2016-05-09 14:10:30 1541

转载 漫画解读HDFS机制

原文http://www.cstor.cn/textdetail_10211.html?ref=myread根据Maneesh Varshney的漫画改编,以简洁易懂的漫画形式讲解HDFS存储机制与运行原理。   一、角色出演    如上图所示,HDFS存储相关角色与功能如下:   Client:客户端,系

2016-05-09 13:13:23 533

原创 110. Balanced Binary Tree

Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never diffe

2015-12-23 11:47:11 338

原创 231. Power of Two

Given an integer, write a function to determine if it is a power of two.class Solution(object):    def isPowerOfTwo(self, n):        """        :type n: int        :rtype: bool        """

2015-12-23 11:45:10 287

原创 263. Ugly Number

Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly sinc

2015-12-23 11:41:55 264

原创 191. Number of 1 Bits

Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11' has binary representation 000000

2015-12-23 11:39:48 273

原创 236. Lowest Common Ancestor of a Binary Tree

Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two node

2015-12-23 11:38:26 288

原创 235. Lowest Common Ancestor of a Binary Search Tree

Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined betw

2015-12-23 11:35:49 251

原创 169. Majority Element

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element

2015-12-23 11:32:58 293

原创 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.# Definition

2015-12-23 11:28:06 317

原创 226. Invert Binary Tree

Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1# Definition for a binary tree node.# class TreeNode(object):# def

2015-12-23 11:25:51 244

原创 283. Move Zeroes

Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3, 12], after calling you

2015-12-23 11:24:04 257

原创 237. Delete Node in a Linked List

Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value

2015-12-23 11:21:58 305

原创 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.class Solution(object): def ma

2015-12-23 11:20:13 284

原创 258. Add Digits

Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has on

2015-12-23 11:18:25 237

原创 292. Nim Game

You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will be the

2015-12-23 11:15:55 273

原创 最短路径—每一对点的最短距离——弗洛伊德

对两点之间距离不断缩小代码voidFloyed(MGraph G){    intC[MAX_VERTEX_NUM][MAX_VERTEX_NUM]; //C中存放最短距离,path中存放最短路径    intpath[MAX_VERTEX_NUM][MAX_VERTEX_NUM];    inti,j,k;

2015-10-21 22:01:58 520

原创 拓扑排序

时间复杂度 O(m+n)检查有向图中是否存在回路的方法之一就是拓扑排序这里记载两种拓扑排序的方法方法一:堆栈或队列法 严蔚敏所著的数据结构书对这段描述存在错误正确的描述应为:在图中选取没有入度的点入栈或入队出栈或出队,将其出度点的入度减一,如果入度数降为0,入栈或入队反复进行2直至栈或队为空,如果出栈或出队总数等于点的总数,则为无环图,小于为有环图,不可

2015-10-21 21:58:05 500

原创 堆排序

思想利用大顶堆(小顶堆)堆顶记录的是最大关键字(最小关键字)这一特性,使得每次从无序中选择最大记录(最小记录)变得简单。    其基本思想为(大顶堆):    1)将初始待排序关键字序列(R1,R2....Rn)构建成大顶堆,此堆为初始的无序区;    2)将堆顶元素R[1]与最后一个元素R[n]交换,此时得到新的无序区(R1,R2,......Rn-1)和新的

2015-10-21 21:55:08 285

原创 快速排序

是对冒泡排序的一种改进,适用于分类(例:把不及格的(=60)放后面)没有归并好,但分类时可以使用49 38 65 97 76 13 27 49{27 38 13}49{76 97 65 49}代码实现:#include using namespace std; void Qsort(int a[],int lo

2015-10-21 21:53:27 266

原创 归并排序

O(nlogn)优点在于有序列成倍增长3 2 5 8 7 1 5 42 3 | 5 8 | 1 7 | 4 52 3 5 8 | 1 4 5 71 2 3 4 5 5 7 8logn遍,每遍n比较    2nlogn移动   多用一个存储空间优化非递归不回写   A->B->A(移动优化为 nlogn移动)与插入结合(开始时可以16)

2015-10-21 21:49:53 242

原创 基数排序

需要知道取值范围倒桶插链尾,反向倒入桶中(先个位后十位){5,10,15,20,21,22,23}个位10,20,21,23,5,15十位 5,10,15,20,21,22,23

2015-10-21 21:41:33 306

内部排序PPT版

内部排序,插入排序,快速排序,冒泡排序。

2012-08-08

空空如也

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

TA关注的人

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