- 博客(18)
- 收藏
- 关注
转载 es分布式架构原理
es分布式架构原理elasticsearch设计的理念就是分布式搜索引擎,底层实现还是基于Lucene的,核心思想是在多态机器上启动多个es进程实例,组成一个es集群。一下是es的几个概念:接近实时 es是一个接近实时的搜索平台,这就意味着,从索引一个文档直到文档能够被搜索到有一个轻微的延迟 集群(cluster) 一个集群有多个节点(服务器)组成,通过所有的节点一起保存你的全部数据...
2018-07-24 16:53:46
16759
1
原创 支持向量机
1.1线性可分支持向量机1.2 函数间隔与几何间隔1.3 间隔最大化1.1线性可分支持向量机我们知道,当训练数据密集可分时,存在无穷个分离超平面可将两类数据正确的分开,感知机是利用误分类最小的原则,求得出分离超平面,不过这样有一个问题,这时的解会有无穷多个。而线性可分支持向量机利用间隔最大的原则,求出最优的分离超平面。这样,解就是唯一的了。1.2 函数...
2018-04-27 10:41:53
261
原创 层次遍历Java
public void levelTrav(TreeNode root){ if(root == null) return ; TreeNode node = root; Queue<TreeNode> queue = new ArrayDeque<>(); queue.add(node); if(!queue.isEmpty()){ node ...
2018-04-23 17:20:36
928
原创 二分查找Java
public int binSearch(int[] nums,int key){ if(nums==null||nums.length<=0) return -1; int mid,left,right; left = 0,right = nums.length-1; while(left<=right){ mid = (right-left)>>...
2018-04-14 15:41:21
165
原创 Java冒泡排序
public void bubbleSort(int[] nums){ boolean change; do{ change = false; for(int i=0;i<nums.length-1;++i){ if(nums[i]>nums[i+1]){ nums[i] = nums[i] ^ nums[i+1]; ...
2018-04-13 10:50:58
116
原创 堆排序简洁正确Java版
public void headSort(int[] nums){ for(int i=nums.length/2-1;i>=0;--i) heapAdjust(nums,i,nums.length-1); for(int i=nums.length-1;i>0;--i){ swap(nums,0,i); heap(nums,0,i-1); }}p...
2018-04-10 23:35:46
186
原创 从根节点找到某一节点的路径
1.首先判断这个树有没有这个节点bool hasNode(TreeNode root,TreeNode node){ if(root==node) return true; bool has = false; if(root.left!=NULL) has = hasNode(root.left,node); if(!has && root.right!=N...
2018-04-08 19:21:21
7667
2
原创 前序中序后序非递归Java版
前序遍历public void preOrder(TreeNode root){ Stack<TreeNode> stack = new Stack<>(); TreeNode node = root; while(node!=null || !stack.isEmpty()) { if(node!=null) { Sy...
2018-04-08 17:23:21
328
原创 561. Array Partition I
Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), …, (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as possib...
2018-04-05 12:03:51
117
原创 560. Subarray Sum Equals K
Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k.Example 1:Input:nums = [1,1,1], k = 2Output: 2Note:The length ...
2018-04-04 17:18:03
155
原创 532. K-diff Pairs in an Array
Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an integer pair (i, j), where i and j are both numbers in...
2018-04-03 10:44:00
166
原创 朴素贝叶斯
朴素贝叶斯基于的是贝叶斯定理与特征条件独立假设的分类方法。==朴素贝叶斯法对条件概率分布作了条件独立性的假设== P(X=x|Y=ck)=P(X(1)=x(1),···,X(n)=x(n)|Y=ck)=∏j=1nP(X(j)=x(j)|Y=ck)P(X=x|Y=ck)=P(X(1)=x(1),···,X(n)=x(n)|Y=ck)=∏j=1nP(X(j)=x(j)|Y=ck)P(X=x|Y...
2018-04-02 18:42:38
132
原创 Java快速排序
格式优美class Solution{ public static void quickSort(int[] arr){ qsort(arr,0,arr.length-1); } private static void qsort(int[] arr, int low ,int high){ int pivot = partition(arr ,low , ...
2018-04-02 11:12:31
192
原创 [leetcode]495. Teemo Attacking
In LOL world, there is a hero called Teemo and his attacking can make his enemy Ashe be in poisoned condition. Now, given the Teemo’s attacking ascending time series towards Ashe and the poisoning tim...
2018-04-02 11:11:27
195
原创 Java内存回收刨析
1.内存模型1.1内存模型概述1.2 详细模型1.2.1 程序计数器1.2.2 虚拟机栈1.2.3 本地方法栈1.2.4 堆1.2.5 方法区1.2.6 运行时常量池2. 内存回收机制2.0 预备知识2.0.1垃圾对象的判定方法:2.0.2 垃圾收集算法2.1 什么时间2. 2 对什么东西2.3 做了什么事1.内存模型1.1...
2018-03-31 08:43:21
363
原创 414. Third Maximum Number && 第n大数求解策略
Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n).Example 1:Input: [3, 2, 1...
2018-03-30 10:13:41
168
原创 感知机策略
力求以通俗易懂的方式将感知机解释明白1.数据集的线形可分性2.感知机学习策略1.数据集的线形可分性假设有这么一个数据集 T={(x1,y1),(x2,y2),···(xn,yn)}T={(x1,y1),(x2,y2),···(xn,yn)}T=\{(x_1,y_1),(x_2,y_2),···(x_n,y_n)\}其中,x~i~∈∈\in R^n^...
2018-03-29 17:36:12
426
原创 380. Insert Delete GetRandom O(1)
Design a data structure that supports all following operations in average O(1) time.insert(val): Inserts an item val to the set if not already present.remove(val): Removes an item val from the set ...
2018-03-29 10:11:05
122
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人