# algorithm-tutorial > 算法、数据结构这类知识点真的需要天分。本人不是算法工程师,也做不了算法工程师。总是在见识到一些算法大神的优雅实现后,感叹于自己是多么的弱智,同样是写代码,我写的是什么垃圾! > > 这个项目的初衷,是将工作中经常会接触到的一些数据结构和算法整理归纳。人总是要有理想的,要想少写垃圾的代码,必须夯实算法的基础。路漫漫兮其修远,吾将上下而求索。 > > 🔁 项目同步维护在 [github](https://github.com/dunwu/algorithm-tutorial) | [gitee](https://gitee.com/turnon/algorithm-tutorial) > > 📖 [电子书](https://dunwu.github.io/algorithm-tutorial/) | [电子书(国内)](http://turnon.gitee.io/algorithm-tutorial/) ## 原理 ### 数据结构 - 线性表 - [数组](docs/data-structure/array.md) - [栈](docs/data-structure/stack.md) - [队列](docs/data-structure/queue.md) - [链表](docs/data-structure/list.md) - [树](docs/data-structure/tree/README.md) - [二叉树](docs/data-structure/tree/binary-tree.md) - [红黑树](docs/data-structure/tree/red-black-tree.md) - B 树 - B+ 树 - [图](docs/data-structure/graph.md) - [堆](docs/data-structure/heap.md) - [散列表](docs/data-structure/hash.md) - [字典树](docs/data-structure/trie.md) ### 算法 - [排序](docs/algorithm/sort.md) - [线性表的查找](docs/algorithm/linear-list-search.md) - [哈希表的查找](docs/algorithm/hash-search.md) ## 刷题 ### 数组 - [寻找数组的中心索引](https://github.com/dunwu/algorithm/blob/master/codes/data-structure/src/main/java/io/github/dunwu/ds/array/FindPivotIndex.java) - [至少是其他数字两倍的最大数](https://github.com/dunwu/algorithm/blob/master/codes/data-structure/src/main/java/io/github/dunwu/ds/array/LargestNumberAtLeastTwiceOfOthers.java) - [加一](https://github.com/dunwu/algorithm/blob/master/codes/data-structure/src/main/java/io/github/dunwu/ds/array/PlusOne.java) - [对角线遍历](https://github.com/dunwu/algorithm/blob/master/codes/data-structure/src/main/java/io/github/dunwu/ds/array/DiagonalTraverse.java) - [螺旋矩阵](https://github.com/dunwu/algorithm/blob/master/codes/data-structure/src/main/java/io/github/dunwu/ds/array/SpiralMatrix.java) - [杨辉三角](https://github.com/dunwu/algorithm/blob/master/codes/data-structure/src/main/java/io/github/dunwu/ds/array/PascalsTriangle.java) - [杨辉三角 II](https://github.com/dunwu/algorithm/blob/master/codes/data-structure/src/main/java/io/github/dunwu/ds/array/PascalsTriangle2.java) - [数组拆分 I](https://github.com/dunwu/algorithm/blob/master/codes/data-structure/src/main/java/io/github/dunwu/ds/array/ArrayPartition.java) - [两数之和 II - 输入有序数组](https://github.com/dunwu/algorithm/blob/master/codes/data-structure/src/main/java/io/github/dunwu/ds/array/TwoSum2InputArrayIsSorted.java) - [移除元素](https://github.com/dunwu/algorithm/blob/master/codes/data-structure/src/main/java/io/github/dunwu/ds/array/RemoveElement.java) - [最大连续 1 的个数](https://github.com/dunwu/algorithm/blob/master/codes/data-structure/src/main/java/io/github/dunwu/ds/array/MaxConsecutiveOnes.java) - [长度最小的子数组](https://github.com/dunwu/algorithm/blob/master/codes/data-structure/src/main/java/io/github/dunwu/ds/array/MinimumSizeSubarraySum.java) - [旋转数组](https://github.com/dunwu/algorithm/blob/master/codes/data-structure/src/main/java/io/github/dunwu/ds/array/RotateArray.java) - [删除排序数组中的重复项](https://github.com/dunwu/algorithm/blob/master/codes/data-structure/src/main/java/io/github/dunwu/ds/array/RemoveDuplicatesFromSortedArray.java) - [移动零](https://github.com/dunwu/algorithm/blob/master/codes/data-structure/src/main/java/io/github/dunwu/ds/array/MoveZeros.java) ### 字符串 - [二进制求和](https://github.com/dunwu/algorithm/blob/master/codes/data-structure/src/main/java/io/github/dunwu/ds/str/AddBinary.java) - [实现 strStr()](https://github.com/dunwu/algorithm/blob/master/codes/data-structure/src/main/java/io/github/dunwu/ds/str/ImplementStrstr.java) - [最长公共前缀](https://github.com/dunwu/algorithm/blob/master/codes/data-structure/src/main/java/io/github/dunwu/ds/str/LongestCommonPrefix.java) - [反转字符串](https://github.com/dunwu/algorithm/blob/master/codes/data-structure/src/main/java/io/github/dunwu/ds/str/ReverseString.java) - [反转字符串中的单词](https://github.com/dunwu/algorithm/blob/master/codes/data-structure/src/main/java/io/github/dunwu/ds/str/ReverseWordsInAString.java) - [反转字符串中的单词 III ](https://github.com/dunwu/algorithm/blob/master/codes/data-structure/src/main/java/io/github/dunwu/ds/str/ReverseWordsInAString3.java) ## 📚 学习资源 - **书籍** - 刷题必备 - 《剑指 offer》 - 《编程之美》 - 《编程之法:面试和算法心得》 - 《算法谜题》 都是思维题 - 基础 - 《[编程珠玑(第 2 版)](https://www.amazon.cn/gp/product/B00SFZH0DC/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&camp=536&creative=3200&creativeASIN=B00SFZH0DC&linkCode=as2&tag=vastwork-23)》 - 《[编程珠玑(续)](https://www.amazon.cn/gp/product/B0150BMQDM/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&camp=536&creative=3200&creativeASIN=B0150BMQDM&linkCode=as2&tag=vastwork-23)》 - 《[数据结构与算法分析 : C++描述(第 4 版)](https://www.amazon.cn/gp/product/B01LDG2DSG/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&camp=536&creative=3200&creativeASIN=B01LDG2DSG&linkCode=as2&tag=vastwork-23)》 - 《[数据结构与算法分析 : C 语言描述(第 2 版)](https://www.amazon.cn/gp/product/B002WC7NGS/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&camp=536&creative=3200&creativeASIN=B002WC7NGS&linkCode=as2&tag=vastwork-23)》 - 《[数据结构与算法分析 : Java 语言描述(第 2 版)](https://www.amazon.cn/gp/product/B01CNP0CG6/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&camp=536&creative=3200&creativeASIN=B01CNP0CG6&linkCode=as2&tag=vastwork-23)》 - 《[算法(第 4 版)](https://www.amazon.cn/gp/product/B009OCFQ0O/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&camp=536&creative=3200&creativeASIN=B009OCFQ0O&linkCode=as2&tag=vastwork-23)》 - 算法设计 - 《[算法设计与分析基础(第 3 版)](https://www.amazon.cn/gp/product/B00S4HCQUI/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&camp=536&creative=3200&creativeASIN=B00S4HCQUI&linkCode=as2&tag=vastwork-23)》 - 《Algorithm Design Manual》 - 算法设计手册 红皮书 - [《算法导论》](https://www.amazon.cn/gp/product/B00AK7BYJY/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&camp=536&creative=3200&creativeASIN=B00AK7BYJY&linkCode=as2&tag=vastwork-23) - 是一本对算法介绍比较全面的经典书籍 - 《Algorithms on Strings,Trees and Sequences》 - 《Advanced Data Structures》 - 各种诡异高级的数据结构和算法 如元胞自动机、斐波纳契堆、线段树 600 块 - 参考链接和学习网站 - https://github.com/TheAlgorithms/Java - https://github.com/nonstriater/Learn-Algorithms - https://github.com/trekhleb/javascript-algorithms - https://github.com/kdn251/interviews/blob/master/README-zh-cn.md#%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84 - [July 博客](http://blog.csdn.net/v_july_v) - 《数学建模十大经典算法》 - 《数据挖掘领域十大经典算法》 - 《十道海量数据处理面试题》 - 《数字图像处理领域的二十四个经典算法》 - 《精选微软等公司经典的算法面试 100 题》 - [The-Art-Of-Programming-By-July](https://github.com/julycoding/The-Art-Of-Programming-By-July) - [微软面试 100 题](http://blog.csdn.net/column/details/ms100.html) - [程序员编程艺术](http://blog.csdn.net/v_JULY_v/article/details/6460494) - 基本算法演示 - - - 编程网站 - [leetcode](http://leetcode-cn.com/) - [openjudge](http://openjudge.cn/) - 其它 - [高级数据结构和算法](https://www.coursera.org/learn/gaoji-shuju-jiegou/) 北大教授张铭老师在 coursera 上的课程。完成这门课之时,你将掌握多维数组、广义表、Trie 树、AVL 树、伸展树等高级数据结构,并结合内排序、外排序、检索、索引有关的算法,高效地解决现实生活中一些比较复杂的应用问题。当然 coursera 上也还有很多其它算法方面的视频课程。 - [算法设计与分析 Design and Analysis of Algorithms](https://class.coursera.org/algorithms-001/lecture) 由北大教授 Wanling Qu 在 coursera 讲授的一门算法课程。首先介绍一些与算法有关的基础知识,然后阐述经典的算法设计思想和分析技术,主要涉及的算法设计技术是:分治策略、动态规划、贪心法、回溯与分支限界等。每个视频都配有相应的讲义(pdf 文件)以便阅读和复习。 ## 🚪 传送门 | [技术文档归档](https://github.com/dunwu/blog) | [算法和数据结构教程系列](https://github.com/dunwu/algorithm-tutorial) |