随笔分类 - [41]Algorithm算法
-
树
摘要:B树、B-树、B+树、B*树 红黑树 http://blog.csdn.net/quitepig/article/details/8041308 B树 即二叉搜索树: 1.所有非叶子结点至多拥有两个儿子(Left和Right); 2.所有结点存储一个关键字; 3.非叶子结点的左指针指向小于其关键字的 阅读全文
-
TF-IDF计算方法和基于图迭代的TextRank
摘要:文本处理方法概述 说明:本篇以实践为主,理论部分会尽量给出参考链接 摘要: 1.分词 2.关键词提取 3.主题模型(LDA/TWE) 4.词的两种表现形式(词袋模型和分布式词向量) 5.关于文本的特征工程 6.文本挖掘(文本分类,文本用户画像) 内容: 1.分词 分词是文本处理的第一步,词是语言的最 阅读全文
-
编程思想与算法
摘要:常用编程思想与算法 本文是在阅读Aditya Bhargava先生算法图解一书所做的总结,文中部分代码引用了原文的代码,在此感谢Aditya Bhargava先生所作出的这么简单的事例,对基础算法感兴趣的朋友可以阅读原文。由于本人也是编程初学者,所以本书比较浅显易懂,所介绍的算法配上插图也十分易懂, 阅读全文
-
基础实用算法
摘要:10大基础实用算法及其讲解 算法一:快速排序算法 快速排序是由东尼·霍尔所发展的一种排序算法。在平均状况下,排序 n 个项目要Ο(n log n)次比较。在最坏状况下则需要Ο(n2)次比较,但这种状况并不常见。事实上,快速排序通常明显比其他Ο(n log n) 算法更快,因为它的内部循环(inner 阅读全文
-
阶梯问题
摘要:经典问题1 1、阶梯问题 问题描述:一个阶梯有n个级,一个人要走完这个阶梯,一步可以走一级或两级,问:共有多少个方案? 解决思路:当n=1时候,只有一种走法,当n=2时候有3种走法;那么n=3时候呢?到第三层的走法是到第一层的走法加上到第二层的走法所以显然这是个经典的递归问题。 因此有a1=1,a2 阅读全文
-
排序算法
摘要:常见的排序算法总结(JavaScript) 引言 排序算法是数据结构和算法之中的基本功,无论是在笔试还是面试,还是实际运用中都有着很基础的地位。这不正直七月,每年校招的备战期,所以想把常见的排序算法记录下来。在本篇文章中的排序算法使用 JavaScript 实现。 一、 冒泡排序 冒泡排序是排序算法 阅读全文
-
数据结构算法
摘要:数据结构与算法 数据结构与算法 什么是数据结构? 指数据元素之间的关系。这些关系可以分为: 集合 线性结构 树形结构 网状结构。 逻辑结构分为: 线性结构 和 非线性结构。 集合:除了同属一个对象外不存在相互关系。如:汽车上的人除了同辆车彼此间无其他关系。 线性结构:元素间为严格的一对一关系,即一个 阅读全文
-
list数组归并去重
摘要:C#两路list数组归并去重 个相同类型已排序数据进行合并,虽然list数组中有AddRange方法,但它只是把第二个数组从第一个数组末尾插入,假如两个数组有重复数据,保存进去。还有Union方法合并去重,首先会从第一个数组进行检查然后再把第二个数组数据从第一个数组依次从末尾插入,但相对于自定义类型 阅读全文
-
八大排序算法
摘要:八大排序算法 概述 排序有内部排序和外部排序,内部排序是数据记录在内存中进行排序,而外部排序是因排序的数据很大,一次不能容纳全部的排序记录,在排序过程中需要访问外存。 我们这里说说八大排序就是内部排序。 当n较大,则应采用时间复杂度为O(nlog2n)的排序方法:快速排序、堆排序或归并排序序。 快速 阅读全文
-
极速的矩形核腐蚀和膨胀(最大值和最小值)
摘要:基于SSE实现的极速的矩形核腐蚀和膨胀(最大值和最小值)算法。 因未测试其他作者的算法时间和效率,本文不敢自称是最快的,但是速度也可以肯定说是相当快的,在一台I5机器上占用单核的资源处理 3000 * 2000的灰度数据用时约 20ms,并且算法和核心的大小是无关的,即所谓的o(1)算法。 在实现本 阅读全文
-
快速傅里叶变换(FFT)
摘要:快速傅里叶变换(FFT)算法【详解】 快速傅里叶变换(Fast Fourier Transform)是信号处理与数据分析领域里最重要的算法之一。我打开一本老旧的算法书,欣赏了JW Cooley 和 John Tukey 在1965年的文章中,以看似简单的计算技巧来讲解这个东西。 本文的目标是,深入C 阅读全文
-
排序算法
摘要:排序算法小结 = 导航 顶部 概述 插入排序法 冒泡排序法 选择排序法 快速排序法 堆排序法 并归排序法 希尔排序法 计数排序法 桶排序 基数排序 其他解析 概述 常见的排序算法都是比较排序,非比较排序包括计数排序、桶排序和基数排序,非比较排序对数据有要求,因为数据本身包含了定位特征,所有才能不通过 阅读全文
-
排序算法比较与分析
摘要:常用排序算法比较与分析 一、常用排序算法简述 下面主要从排序算法的基本概念、原理出发,分别从算法的时间复杂度、空间复杂度、算法的稳定性和速度等方面进行分析比较。依据待排序的问题大小(记录数量 n)的不同,排序过程中需要的存储器空间也不同,由此将排序算法分为两大类:【内排序】、【外排序】。 内排序:指 阅读全文
-
排序
摘要:你必须要了解的几种排序方法 作为一个程序员,你怎么能不了解冒泡算法呢? 下面向大家介绍六中排序算法,并提供javascript实现,以及简单分析算法复杂度。 1. 简单排序方法 1.1 冒泡排序 总体描述: 相邻元素进行比较,每次选取最大的元素,进行下一次比较,因此可以将最大的元素像冒泡一样,从某一 阅读全文
-
排序与基础数据结构
摘要:6大排序与6大基础数据结构 本文从冒泡排序撩起,对选择、插入、希尔、归并、快排6种经典的数组排序进行了深入分析,并详解其间的关联,让你深刻理解其中的关键点;同时对经典的数据结构Vector、Stack、Queue、树、Map、Set做了归纳总结,对其底层的实现做了解析,分享给大家,作为每一个中高级程 阅读全文
-
贝叶斯平滑方法及其代码实现
摘要:贝叶斯平滑方法及其代码实现 1. 背景介绍 广告形式: 互联网广告可以分为以下三种: 1)展示广告(display ad) 2)搜索广告(sponsored search ad) 3)上下文广告(contextual ad) 竞价模式: 对于在线广告,主要有以下几种竞价模式: 1)pay-per-i 阅读全文
-
链表Linked List
摘要:链表Linked List 1. 链表 数组是一种顺序表,index与value之间是一种顺序映射,以O(1)O(1)的复杂度访问数据元素。但是,若要在表的中间部分插入(或删除)某一个元素时,需要将后续的数据元素进行移动,复杂度大概为O(n)O(n)。链表(Linked List)是一种链式表,克服 阅读全文
-
01背包问题
摘要:01背包问题 基本思想: 动态规划算法通常用于求解具有某种最优性质的问题。在这类问题中,可能会有许多可行解。每一个解都对应于一个值,我们希望找到具有最优值的解。动态规划算法与分治法类似,其基本思想也是将待求解问题分解成若干个子问题,先求解子问题,然后从这些子问题的解得到原问题的解。与分治法不同的是, 阅读全文
-
JavaScript实现算法
摘要:leetcode算法题(JavaScript实现) 题外话 刷了一段时间的codewars的JavaScript题目之后,它给我最大的感受就是,会帮助你迅速的提升你希望练习的语言的API的熟悉程度,Array对象、String对象等原生方法,构造函数、一些算法题等。每次submit之后,看看自己的代 阅读全文
-
布隆过滤器(Bloom Filter)
摘要:布隆过滤器(Bloom Filter)的原理和实现 布隆过滤器(Bloom Filter)的原理和实现 什么情况下需要布隆过滤器? 先来看几个比较常见的例子 字处理软件中,需要检查一个英语单词是否拼写正确 在 FBI,一个嫌疑人的名字是否已经在嫌疑名单上 在网络爬虫里,一个网址是否被访问过 yaho 阅读全文