
算法
七夕先生
君子不器
展开
-
MIT 6.006 Lecture 1-a 笔记
MIT 6.006 Lecture 1-a 笔记这是6.006课程的概述部分,主要是对课程的介绍。第一模块的问题讲解从Lecture 1-b开始。清爽版传送门课程概述一句话概括这门课程:Efficient procedures for solving problems on large inputs.The world is moving faster, things get...翻译 2019-01-20 22:55:59 · 1154 阅读 · 0 评论 -
MIT 6.006 Lecture 1-b 笔记
Lecture 1-b 笔记——Peak finder这节主要讲解”极值点问题“(Peak finder),通过不同解决思路之间的对比来理解如何设计高效算法。纯净版传送门We pick this problem, peak finder, because it’s so easy to understand, and there are fairly straightforward a...翻译 2019-01-20 23:20:54 · 739 阅读 · 1 评论 -
leetcode 162 Find Peak Element
leetcode 162 Find Peak Element这个题目是MIT 6.006算法课中提到的第一个问题,也就是一维数组的Peak Finder问题。如果感兴趣看一看一下我的MIT 6.006 Lecture 1-b 笔记。在对比不同解题思路的同时,我还对比了不同语言(c、C++、Python)。能够非常明显的看出在效率方面:c > C++ > Python;时间复杂度最高...原创 2019-01-23 14:29:07 · 202 阅读 · 0 评论 -
MIT 6.006 Lecture3 插入排序和归并排序
MIT 6.006 Lecture3 插入排序和归并排序这是排序部分的第一讲,我们会先介绍一下排序问题及其应用,然后介绍插入排序和归并排序两种算法,并对比。最后用Python实现这两种算法。清爽版入口排序问题及其应用什么是排序问题Input:array A[1…n] of numbers.Output:permutation B[1…n] of A such that B[1]...翻译 2019-02-27 20:52:34 · 344 阅读 · 0 评论 -
leetcode 53 Maximum Subarray
leetcode 53 Maximum Subarray最大子序列和问题是用于讲解分治策略的一个经典例题,这个例题可以帮助我们很好的理解分治策略。但对于这个问题,分治策略并不是最高效的算法。清爽版入口问题描述给定一个整数数组 nums ,找到其中一个具有最大和的连续子数组(子数组最少包含一个元素),返回其最大和。示例:输入: [-2,1,-3,4,-1,2,1,-5,4],输出: ...原创 2019-02-26 18:57:14 · 176 阅读 · 0 评论