随笔分类 - [41]Algorithm算法
-
Kaggle入门
摘要:Kaggle入门 1:竞赛 我们将学习如何为Kaggle竞赛生成一个提交答案(submisson)。Kaggle是一个你通过完成算法和全世界机器学习从业者进行竞赛的网站。如果你的算法精度是给出数据集中最高的,你将赢得比赛。Kaggle也是一个实践你机器学习技能的非常有趣的方式。Kaggle网站有几种 阅读全文
-
两个栈实现一个队列
摘要:两个栈实现一个队列 拿到这种问题,我们首先应该思考这两种结构的特性是什么,为什么会出这样的题。其实就说明这两者的特性是有某种联系的,这么想的话其实很简单,栈的最大特点就是先进后出,让我们用两个先进后出的栈来实现一个先进先出的队列,那么我们把数据压入第一个栈,此时我们很清楚它的出战顺序是与我们想要的队 阅读全文
-
排序算法
摘要:常见排序算法C++总结 重新画了总结图 看了图,我这里就总结一下 直接插入排序,冒泡排序,快速排序,堆排序和归并排序 直接插入排序 整个序列分为有序区和无序区,取第一个元素作为初始有序区,然后第二个开始,依次插入到有序区的合适位置,直到排好序 刚开始在我那本《数据结构》看到大概这样的实现 void 阅读全文
-
银行家
摘要:银行家算法 1 需求分析 1.1 银行家算法的实现思想 允许进程动态地申请资源,系统在每次实施资源分配之前,先计算资源分配的安全性,若此次资源分配安全(即资源分配后,系统能按某种顺序来为每个进程分配其所需的资源,直至最大需求,使每个进程都可以顺利地完成),便将资源分配给进程,否则不分配资源,让进程等 阅读全文
-
蚁群算法
摘要:自话蚁群算法 这算是填3年前的一个坑吧,已经懒癌晚期了,想必也还是要挣扎下,那今天先从蚁群算法这个坑说起,如果你是要寻找怎么优化蚁群算法,可以直接跳过本文,如果你还不了解什么是蚁群算法,或许本文能够提起你的兴趣。 如果你同样对遗传算法和粒子群算法感兴趣,请查看3年前我对于这两个算法见解的文章。 自话 阅读全文
-
算法
摘要:算法 再次重申一下,这里只是列出一些最近遇到的算法面试题,拿出来给大家分享一下面试经历(仅是常见算法方面的经历,还有一些不常见的就懒得列举了,技术方向的不介绍)。还有就是我的答案。ps:无论是算法题还是答案都不具任何代表性也并非是正确答案,仅仅是我面试的时候给出的答案,只是分享而已。另外,对于我所列 阅读全文
-
机器学习算法
摘要:机器学习算法 什么是程序(Program) 计算机程序,是指为了得到某种结果而可以由计算机(等具有信息处理能力的装置)执行的代码化指令序列(或者可以被自动转换成代码化指令序列的符号化指令序列或者符号化语句序列)。 通俗讲,计算机给人干活,但它不是人,甚至不如狗懂人的需要(《小羊肖恩》里的狗是多么聪明 阅读全文
-
一致性算法--Raft
摘要:分布式一致性算法--Raft 前面一篇文章讲了Paxos协议,这篇文章讲它的姊妹篇Raft协议,相对于Paxos协议,Raft协议更为简单,也更容易工程实现。有关Raft协议和工程实现可以参考这个链接https://raft.github.io/,里面包含了大量的论文,视屏已经动画演示,非常有助于理 阅读全文
-
一致性算法--Paxos
摘要:分布式一致性算法--Paxos Paxos算法是莱斯利·兰伯特(Leslie Lamport)1990年提出的一种基于消息传递的一致性算法。Paxos算法解决的问题是一个分布式系统如何就某个值(决议)达成一致。在工程实践意义上来说,就是可以通过Paxos实现多副本一致性,分布式锁,名字管理,序列号分 阅读全文
-
GC算法
摘要:GC算法 垃圾收集器 GC算法 垃圾收集器 概述 垃圾收集 Garbage Collection 通常被称为“GC”,它诞生于1960年 MIT 的 Lisp 语言,经过半个多世纪,目前已经十分成熟了。 jvm 中,程序计数器、虚拟机栈、本地方法栈都是随线程而生随线程而灭,栈帧随着方法的进入和退出做 阅读全文
-
KNN算法
摘要:KNN算法 一、KNN算法概述 KNN是Machine Learning领域一个简单又实用的算法,与之前讨论过的算法主要存在两点不同: 它是一种非参方法。即不必像线性回归、逻辑回归等算法一样有固定格式的模型,也不需要去拟合参数。 它既可用于分类,又可应用于回归。 KNN的基本思想有点类似“物以类聚, 阅读全文
-
几种能在O(n*log(n))时间排序
摘要:线性时间排序 各种排序算法总结已经介绍了几种能在O(n*log(n))时间内培训n个数的算法。归并排序和堆排序达到了最坏情况下的上界;快速排序在平均情况下达到该上界。这些算法都有一个有趣的性质:在排序的最终结果中,各元素的次序依赖于它们之间的比较。这类算法为比较算法,还有一类算法是线性时间复杂度的排 阅读全文
-
bestcoder.hdu.edu.cn
摘要:http://bestcoder.hdu.edu.cn/ Problem A 题目链接: http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=690&pid=1001 http://acm.hdu.edu.cn/showp 阅读全文
-
深入理解
摘要:深入理解递归 递归的思想 以此类推是递归的基本思想。 具体来讲就是把规模大的问题转化为规模小的相似的子问题来解决。在函数实现时,因为解决大问题的方法和解决小问题的方法往往是同一个方法,所以就产生了函数调用它自身的情况。另外这个解决问题的函数必须有明显的结束条件,这样就不会产生无限递归的情况了。 递归 阅读全文
-
堆排序
摘要:图解堆排序 摘要: 作为选择排序的改进版,堆排序可以把每一趟元素的比较结果保存下来,以便我们在选择最小/大元素时对已经比较过的元素做出相应的调整。 堆排序是一种树形选择排序,在排序过程中可以把元素看成是一颗完全二叉树,每个节点都大(小)于它的两个子节点,当每个节点都大于等于它的两个子节点时,就称为大 阅读全文
-
Cracking the coding interview--问题与解答
摘要:http://www.hawstein.com/posts/ctci-solutions-contents.html 作者:Hawstein出处:http://hawstein.com/posts/ctci-solutions-contents.html声明:本文采用以下协议进行授权: 自由转载-非 阅读全文
-
排序算法总结
摘要:趁着有时间把学习过的排序算法又实现了一遍复习一下,实现的排序算法主要有以下几种:冒泡排序、快速排序,选择排序,堆排序,插入排序,合并排序,希尔排序,桶排序等。 下面是网上找的一张图片,总结了常见排序算法的时间复杂度、空间复杂度以及稳定性,可以参考一下。 下面排序的都是vector<int>,懒得写模 阅读全文
-
图文并茂排序与算法
摘要:图文并茂排序与算法总结 转载请注明出处:http://www.cnblogs.com/Joanna-Yan/p/5094764.html 总结下常用的排序算法,方便以后查阅。 常见排序算法:冒泡排序、选择排序、插入排序、壳(shell)排序、合并排序、快速排序、堆排序。 要选择合适的算法,需考虑的因 阅读全文
-
排序算法
摘要:面试中的排序算法总结 前言 查找和排序算法是算法的入门知识,其经典思想可以用于很多算法当中。因为其实现代码较短,应用较常见。所以在面试中经常会问到排序算法及其相关的问题。但万变不离其宗,只要熟悉了思想,灵活运用也不是难事。一般在面试中最常考的是快速排序和归并排序,并且经常有面试官要求现场写出这两种排 阅读全文
-
排序算法
摘要:排序算法——堆排序 ~大器晚成~ 2012-03-08 09:46 阅读:11393 评论:5 查找算法——找到序列中第二大的数(修正版) ~大器晚成~ 2012-03-06 10:35 阅读:5687 评论:66 排序算法——快速排序 ~大器晚成~ 2012-02-29 10:13 阅读:1141 阅读全文