Xander

V2

2022/11/11阅读:28主题:橙心

How can I learn algorithms and data...

Introduce

SourceHow can I learn algorithms and data structures from scratch? - Quora

It feels like this site has a foreign flavor of Zhihu

Plan

Day −∞−∞ to 0: Stick to a programming language like C or C++. Make sure that you are comfortable with pointers/objects.

对象和指针理解

Day 1: Understand the concept of Algorithmic complexity[1]. Skip the theory for now, but for every piece of code you write, you should be able to derive both time and space complexity.

时间复杂度和空间复杂度了解,可以估算算法的时间和空间复杂度,理论部分可以跳过

Day 2 - 10: Let’s start with some simple data structures,

  1. Arrays
  2. Linked Lists
  3. Strings
  4. Stacks
  5. Queues

Understand their basic operations (insert, delete, search, traversal) and their complexity - Big-O Algorithm Complexity Cheat Sheet[2], and code them all.

理解常见线性和非线性数据结构的增删改查的细节。

Day 11 - 25: Let’s now learn some simple algorithms,

  1. Sorting - Insertion sort[3]Merge sort[4]Quick sort[5]Heap sort[6]Bucket sort[7]Counting sort[8]Radix sort[9]External sorting[10]
  2. Search - Linear search[11]Binary Search[12] (along with its variants).
  3. Prime Numbers - Sieve of Eratosthenes[13]Primality test[14]
  4. Strings - String searching[15]LCS[16]Palindrome detection[17]
  5. Miscellaneous - Euclidean algorithm[18]Matrix multiplication[19]Fibonacci Numbers[20]Pascal's Triangle[21]Max Subarray problem[22]

归纳:

  • 常见排序算法
  • 搜索算法
  • 素数
  • 字符串查找
  • 杂七杂八算法

Day 26 - 50: Once you are comfortable with everything above, start doing problems from,

  1. Cracking the Coding Interview[23]
  2. Elements of Programming Interviews[24]
  3. Programming Interviews Exposed: Secrets to Landing Your Next Job[25]
  4. GeeksforGeeks[26]
  5. HackerRank[27]
  6. InterviewBit[28]

面试常考算法,然后需要反复练习常见数据结构的相关算法

Stick to chapters of arrays, linked lists, strings, stacks, queues and complexity.

Day 51 - 60: Let’s learn some non-linear data structures,

非线性结构算法学习

  1. Tree

  2. Binary Tree, Binary Search Tree - Tree traversals[29]Lowest common ancestor[30]Depth, Height & Diameter[31]Finding k-th smallest element[32]

  3. Heaps

  4. Hash table - 4 sum problem[33]Checking if sudoku solution is valid[34]

  5. Graph - Breadth-first search[35]Depth-first search[36]Topological sorting[37]Minimum spanning tree[38]Shortest path problem[39],

二叉树、二叉树查找 哈希表 垃圾回收算法。 图

Day 61- 90: Refer to the previous resources and start doing problems from trees, hash tables, heaps and graphs.

参考之前的练习,使用非线性结构的思维模式重做一遍。

Day 91 - 100: Understand Computational complexity theory[40] and NP-completeness[41]Knapsack problem[42]Travelling salesman problem[43]SAT problem[44] and so on.

理解计算机复杂性理论,NP,SAT,TSP、动态规划等。

Day 101 - ∞∞: You are now better than most of the CS undergrads. Keep revising the above topics and start competitive programming! Good luck!

你现在比大多数的CS本科生都要好。继续复习上述题目,并开始竞争性的编程! 祝您好运!

参考资料

[1]

en.wikipedia.org: https://en.wikipedia.org/wiki/Algorithmic_complexity

[2]

bigocheatsheet.com: http://bigocheatsheet.com/

[3]

en.wikipedia.org: https://en.wikipedia.org/wiki/Insertion_sort

[4]

en.wikipedia.org: https://en.wikipedia.org/wiki/Merge_sort

[5]

en.wikipedia.org: https://en.wikipedia.org/wiki/Quicksort

[6]

en.wikipedia.org: https://en.wikipedia.org/wiki/Heapsort

[7]

en.wikipedia.org: https://en.wikipedia.org/wiki/Bucket_sort

[8]

en.wikipedia.org: https://en.wikipedia.org/wiki/Counting_sort

[9]

en.wikipedia.org: https://en.wikipedia.org/wiki/Radix_sort

[10]

en.wikipedia.org: https://en.wikipedia.org/wiki/External_sorting

[11]

en.wikipedia.org: https://en.wikipedia.org/wiki/Linear_search

[12]

www.topcoder.com: https://www.topcoder.com/community/data-science/data-science-tutorials/binary-search/

[13]

en.wikipedia.org: https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes

[14]

en.wikipedia.org: https://en.wikipedia.org/wiki/Primality_test

[15]

en.wikipedia.org: https://en.wikipedia.org/wiki/String_searching_algorithm

[16]

en.wikipedia.org: https://en.wikipedia.org/wiki/Longest_common_subsequence_problem

[17]

www.rosettacode.org: https://www.rosettacode.org/wiki/Palindrome_detection

[18]

en.wikipedia.org: https://en.wikipedia.org/wiki/Euclidean_algorithm

[19]

en.wikipedia.org: https://en.wikipedia.org/wiki/Matrix_multiplication

[20]

en.wikibooks.org: https://en.wikibooks.org/wiki/Algorithm_Implementation/Mathematics/Fibonacci_Number_Program

[21]

www.geeksforgeeks.org: http://www.geeksforgeeks.org/pascal-triangle/

[22]

en.wikipedia.org: https://en.wikipedia.org/wiki/Maximum_subarray_problem

[23]

www.amazon.com: https://www.amazon.com/Cracking-Coding-Interview-Programming-Questions/dp/0984782850

[24]

www.amazon.com: https://www.amazon.com/Elements-Programming-Interviews-Insiders-Guide/dp/1479274836

[25]

www.amazon.com: https://www.amazon.com/Programming-Interviews-Exposed-Secrets-Landing/dp/1118261364

[26]

www.practice.geeksforgeeks.org: http://www.practice.geeksforgeeks.org/

[27]

www.hackerrank.com: https://www.hackerrank.com/

[28]

www.interviewbit.com: https://www.interviewbit.com/invite/afaf

[29]

en.wikipedia.org: https://en.wikipedia.org/wiki/Tree_traversal

[30]

en.wikipedia.org: https://en.wikipedia.org/wiki/Lowest_common_ancestor

[31]

stackoverflow.com: http://stackoverflow.com/questions/2603692/what-is-the-difference-between-tree-depth-and-height

[32]

www.geeksforgeeks.org: http://www.geeksforgeeks.org/find-k-th-smallest-element-in-bst-order-statistics-in-bst/

[33]

www.sigmainfy.com: http://www.sigmainfy.com/blog/4sum-problem-analysis-different-time-complexity.html

[34]

stackoverflow.com: http://stackoverflow.com/questions/5484629/check-if-sudoku-solution-is-valid

[35]

en.wikipedia.org: https://en.wikipedia.org/wiki/Breadth-first_search

[36]

en.wikipedia.org: https://en.wikipedia.org/wiki/Depth-first_search

[37]

en.wikipedia.org: https://en.wikipedia.org/wiki/Topological_sorting

[38]

en.wikipedia.org: https://en.wikipedia.org/wiki/Minimum_spanning_tree

[39]

en.wikipedia.org: https://en.wikipedia.org/wiki/Shortest_path_problem

[40]

en.wikipedia.org: https://en.wikipedia.org/wiki/Computational_complexity_theory

[41]

en.wikipedia.org: https://en.wikipedia.org/wiki/NP-completeness

[42]

en.wikipedia.org: https://en.wikipedia.org/wiki/Knapsack_problem

[43]

en.wikipedia.org: https://en.wikipedia.org/wiki/Travelling_salesman_problem

[44]

en.wikipedia.org: https://en.wikipedia.org/wiki/Boolean_satisfiability_problem

分类:

阅读

标签:

阅读

作者介绍

Xander
V2

摸鱼JAVA工程师 公众号:懒时小窝