[Reserved] programmer must master the core algorithms What?

As has been emphasized the importance of data structures and algorithms to learn before me, so there are some readers often ask me, data structures and algorithms should learn to what extent? , To be honest, the problem I do not know how to answer you, depending on to what extent you want to learn, but for this problem, I summarize the algorithm a little knowledge I learned, and I think it is worth learning algorithm. These learning algorithms and data structures are mostly fragmented , and no one book put them all covered. Here's what I think a number of algorithms and data structures worth learning, of course, I will organize a number of good article for everyone to read. You can also supplement the comments section.

First, the most basic algorithm

1, time complexity

2, space complexity

It is the time complexity and space is generally the first contact with the complexity of the study, and how to calculate these two concepts is the need to learn, but also to be the first to learn of the main maximum complexity, average complexity, etc., directly through learning to blog search.

Recommended article:

Algorithm analysis artifact - time complexity

Second, the basic data structure

1, the linear form

  • List (will learn)
  • List (will learn)
  • Jump table (know the principles, applications, and finally achieve their own again)
  • Disjoint-set (the proposed combination of learning problems brush)

Needless to say, the list, the list must, however, focus is on the list.

Three minutes of basic data structures: how easy it is handwritten list?

After the interviewer may ask you "jump list", you put this article to throw him

2, the queue stack

  • Stack (will learn)
  • Queue (must learn)
  • Priority queue, heap (will learn)
  • Multilevel feedback queue (Principles and Applications)

In particular priority queue, painted the theme of time, or frequently used, queue and stack is the most basic data structure must learn. You can learn through the blog. related articles:

Three minutes basics: What is a stack?

Binary heap What the hell?

Algorithms and Data Structures] [heapsort What the hell?

3. hash table (will learn)

  • Collision Solution: open-addressable, chain address law again hashing, establish common overflow area (will learn)
  • Bloom filter (Principles and Applications)

Hash table related recommendation to learn through the blog, the article recommended:

Hash opening address conflict law

4, tree

  • Binary: Various traversal (recursive and non-recursive) (will learn)
  • Huffman coding (Principles and Applications)
  • AVL tree (will learn)
  • B-tree and B + Tree (Principle and Applications)
  • Prefix tree (Principles and Applications)
  • Red-black tree (Principles and Applications)
  • Segment tree (Principles and Applications)

Tree or with a lot of relevant knowledge, recommended reading, you can see "algorithm, Fourth Edition." related articles:

HF face questions: What is a B tree? Why use a B-tree index file instead of a binary search tree?

[Comics] after the interviewer may ask you AVL tree, you'll throw him in this article.

Tencent face questions: With binary search tree, balanced tree why need red-black tree?

[Interview] abused games sensitive word filtering is how to achieve?

5, the array

  • Fenwick tree
  • Matrix (will learn)

Fenwick tree In fact, I never learned ,,,,

Third, a variety of common algorithms

1, the top ten ranking algorithm

  • Simple Sequencing: insertion sort, selection sort, bubble sort (must learn)
  • Divide and Conquer Sort: quick sort, merge sort (must learn, but also concerned about the rapid sequencing of selected mode axis)
  • Assign a rank: bucket sort, radix sort
  • Sort tree: heap sort (will learn)
  • Other: Counting Sort (will learn), Hill sorting

For ten learning algorithm, if you do not quite understand, then I recommend you go to quite the book, read the book because you may not know how to write the algorithm, but also to know how he came. Recommended books are "algorithm the fourth edition of" This book is about in great detail, and with a lot of map presentation, still in very good understand.

recommended article:

Will learn ten classic sort algorithm, look at this is enough (attach complete code / action figure / quality articles) (Revised Edition)

2, graph theory algorithms

  • FIG represents: an adjacency matrix and adjacency list
  • Traversal algorithms: depth and breadth Search Search (will learn)
  • Shortest path algorithm: Floyd, Dijkstra (will learn)
  • Minimum spanning tree algorithm: Prim, Kruskal (will learn)
  • Actual commonly used algorithms: Critical Path, topological sorting (Principles and Applications)
  • Bipartite graph matching: matching, Hungarian Algorithm (Theory and Application)
  • Development: central algorithm, algorithm (Principles and Applications) communities found

Figure is quite difficult, but I think a lot drawing algorithms involved are very useful, for example, to calculate the shortest path, etc., chart-related, I recommend reading here, you can see "algorithm, Fourth Edition."

Comic: What is the "map"? (revised edition)

Comic: depth-first traversal and breadth-first traversal

Comic: "shortest path" map problem

Comic: Dijkstra algorithm optimization

Cartoon: "multi-source" shortest route map

More learning algorithm, I welcome the attention of the public number " handsome programmed to play ."

3, search and backtracking algorithm

  • Greedy algorithm (will learn)
  • Heuristic search algorithm: A * pathfinding algorithm (understand)
  • Map coloring algorithm, N queens problem, the optimal processing sequence
  • Traveling Salesman Problem

This handy just some of the algorithms are related, I think if you can, learn all about. Like greedy idea of ​​the algorithm, it is necessary to learn the. Learn by brush is recommended title, leetcode directly topic brush.

4, dynamic programming

  • Tree DP: 01 knapsack problem
  • Linear DP: the longest common subsequence, longest common substring
  • Interval DP: maximum value matrix (sum and product)
  • Digital DP: a numbers game
  • Status compression DP: Traveling Salesman

I think the dynamic programming algorithm is the most difficult one thought, and I remember the first contact with the original dynamic programming, is to look at 01 knapsack problem, I looked a long time do not quite understand, muddle, understand the basic idea behind, but do not question at hand, but see to understand the answer. Angrily, then leetcdoe continuous brush dozens of topics, to master the dynamic programming routines , also have their own set of templates. But to be honest, dynamic programming, is to test the damn much, learning algorithms, brush problems, we must grasp. It is recommended to first understand what dynamic programming is that after leetcode topic brush, anyway, generally above these types of questions. Behind time, I also learned to write about my routine , somewhat similar to my previous write recursive as be an experience. That is, when do question my template, but the feeling was written seventy-eight hours ,,,,, have time to write. Before writing recursive article: Why did you not learn recursion? Farewell recursion, to talk about some of my experiences

5, character matching algorithm

  • Regular Expressions
  • Pattern Matching: KMP, Boyer-Moore

I wrote two string matching the article, I feel pretty good, read these two articles, I think you almost know kmp and the Boyer-Moore.

Boyer-Moore string matching algorithm: How to Find function text editor is implemented?

More learning algorithm, I welcome the attention of the public number " hard to force the farming code ."

6, flow correlation algorithm

  • Maximum Flow: The shortest augmenting path, Dinic algorithm
  • Maximum flow: the maximum benefit issues, grid access issues
  • Minimum Cost Maximum: minimum cost path, recreation

Some algorithms in this area, and I only know some interested can learn under.

to sum up

For the design of algorithms to above, I have provided a feeling pretty good article, it proposed collection, then you can make use of fragmented time to read, some people may feel too much above algorithm, to be honest, I feel much, especially for students, the above algorithms involved can not really understand, but at least have to understand. As for books, and if you have even the basic data structures still do not understand, it is recommended to see "Data Structures and Algorithms" books, such as "Westward data structure", "data structure and algorithm analysis." If you have some foundation, for example, knows linked lists, stacks, queues, you can see "algorithm, Fourth Edition", but this book is implemented in Java, but I think as long as you learned C, you can see to understand.

These algorithms learn, learn while you think there is no use, but still those words, it is affecting your subconscious, it can give you is to lay a solid foundation of internal strength, if you want to go farther, then I recommend learning, mark will learn , then I think you really need to take the time to learn under the label principle and application of, on behalf of you may not know how to achieve with the code, but its implementation must know the principles and applications, more learning algorithm, we can continue to focus on my micro-channel public number Le.

As a great emphasis on basic computer and algorithm programmer learning, self-study along the way, have seen a lot of good quality books, recommend it to everyone here, all seen the drops themselves.

Finally, many people ask me is how to learn, then I simply put the books I've seen high contribution out :

Computer Basics Recommended : "How to run the program up," "network connection is how" and "how computers work"

Further understanding of computer networks : "Computer Networks: top-down", "diagram http"

Data structures + algorithms entry : "Data Structures and Algorithms analysis: C language description Edition," "Westward data structure", "Aha algorithm"

Advanced algorithm : "algorithm, Fourth Edition," "Beauty of Programming", "Programming Pearls"

Because I am a Java technology stack, by the way recommend basic Java books, by the order from left to see

Java : "Java core technology Volume 1", "programming ideas", "in-depth understanding of the Java Virtual Machine," "Java Programming Art"

Database: "mysql must know will be", "MySQL Inside: InnoDB storage engine."

To introduce so many, these are the most basic core drops, I hope to help those who do not know to see what books students

By the way, I introduced these books, I might as well help you organize, you can "in my original micro-channel public number handsome programmed to play " reply " books " Oh acquisition

Harvest? They want the old iron to a trifecta, more people read this article

1, the old iron who pay attention to my original micro-channel public number " handsome to play programmed " to focus on writing algorithms + basic computer knowledge (computer network + operating system + database + Linux), save let you read gain something, do not believe You hit me.

2, to a point I praise chant , so that more people can see this article, by the way inspired me, hee hee.

Author info

Author: handsome, a guy who loves writing
original public number: "handsome programmed to play" , has written more than 150 articles, focusing on writing algorithms, basic computer knowledge to enhance the internal strength of your article, look forward to your attention.
Reprinted Note: Be sure to indicate the source (note: from public number: hard to force the code farmers, author: handsome earth)

                                </div>
发布了5 篇原创文章 · 获赞 0 · 访问量 1110

Guess you like

Origin blog.csdn.net/u013310037/article/details/104741740