![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
文章平均质量分 62
japinli
这个作者很懒,什么都没留下…
展开
-
分治法 & 归并排序
归并排序主要利用了是分治思想,将原有的问题分解成几个规模较小的类似于原问题的子问题,通过递归的求解子问题,然后合并子问题的解来求取原问题的解。原创 2016-03-16 11:11:53 · 608 阅读 · 0 评论 -
最长公共子串
求解两个字符串的最长公共字符串。原创 2016-07-01 15:45:02 · 618 阅读 · 0 评论 -
LeetCode - Linked List Cycle
Given a linked list, determine if it has a cycle in it. if it has a cycle you should return the node which the cycle begins.原创 2016-08-06 14:51:43 · 237 阅读 · 0 评论 -
LeetCode - Single Number
Given an array of integers, every element appears twice(three) times except for one. Find that single one.原创 2016-08-05 19:05:03 · 319 阅读 · 0 评论 -
Algorithms Every Data Scientist Should Know: Reservoir Sampling
you have a stream of items of large and unknown length that we can only iterate over once. Create an algorithm that randomly chooses an item from this stream such that each item is equally likely to be selected转载 2016-08-17 14:36:02 · 695 阅读 · 0 评论 -
LeetCode - Add Two Numbers
You are given two linked lists representing two non-negativenumbers. The digits are stored in reverse order and each of theirnodes contain a single digit. Add the two numbers and return it as alinked list原创 2016-08-05 10:22:36 · 308 阅读 · 0 评论 -
LeetCode - Two Sum
LeetCode 题目1两数之和原创 2016-08-05 10:19:33 · 261 阅读 · 0 评论 -
LeetCode - Longest Palindromic Substring
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.原创 2016-08-12 20:50:22 · 237 阅读 · 0 评论 -
堆排序
概述堆,可以视为一颗完全二叉树,其节点之间满足父节点不小于(不大于)两个子节点的值,这样的堆被称为大(小)根堆。用数学符号表示为:大根堆:A[parent(i)] >= A[i]小根堆:A[parent(i)] <= A[i]在堆排序中,需要能够快速的找到节点的父节点,及其左右孩子节点。例如数组A[0 … n],可以将下标与树的节点按照下图进行匹配。通过上图的方式给树的节点与数组下标的建立对应原创 2016-03-17 17:11:52 · 435 阅读 · 0 评论 -
最长公共子序列
递归及动态规范求解最长公共子序列问题。原创 2016-06-27 20:45:09 · 363 阅读 · 0 评论 -
动态规划
概述动态规划(dynamic programming)类似于分治法,都是通过组合子问题的解来求解原问题。不同的是,分治法将原问题划分为互不重叠的子问题,递归的求解,在将子问题的解合并,从而求解原问题的解。动态规划则通常应用用子问题重叠的情况,即不同的子问题具有公共的子子问题。原创 2016-05-09 21:08:11 · 1077 阅读 · 0 评论 -
基数排序
基数排序和计数排序类似,都不是基于关键字比较的排序算法。基数排序算法基于提取操作,即从一个关键字中提取出第i位进行排序。为了确保基数排序的正确性,每位的排序算法必须是稳定(数字的相对位置不能发生变化)的,计数排序就是不错的选择。基数排序有两种方式:首先处理高位的数字称为最高位优先(most significant digit, MSD),和最低为优先(least significant digit, LSD)。原创 2016-03-26 16:50:06 · 589 阅读 · 0 评论 -
计数排序
计数排序不是比较排序,排序速度快于任何比较排序算法,它是一种稳定的线性时间排序算法。假设有n输入元素(均为整数)中的每个值都在区间[0,k)(k为整数)上,则辅助数组大小为k。辅助数组第i个元素表示待排序数组中小于等于i的数出现的次数。原创 2016-03-23 16:53:48 · 384 阅读 · 0 评论 -
快速排序
基本思想快速排序算法的基本思想与归并算法相似,也是采用分治法的一种排序算法。该算法通过随机选取一个待排序元素,然后以该元素为基准,将数组划分为两个部分,之后分别对两个子数组采用此方法进行排序。快速排序算法的核心在于数组的划分,在对数组A[l, …, r]进行划分后,满足以下三个条件:对于某个i,A[i]在数组的最终位置上。A[l, …, i-1]中的所有元素都比A[i]下。A[i+1, …,原创 2016-03-20 21:32:44 · 409 阅读 · 0 评论 -
堆排序(非递归)
堆排序非递归算法及通用形式原创 2016-03-18 11:47:25 · 746 阅读 · 0 评论 -
Rsync同步算法
Rsync同步算法原创 2017-05-29 14:58:08 · 579 阅读 · 0 评论