1. What is the use of learning data structures?
2. Is it necessary to learn the algorithm?
Reply content:
Personally think data structure is one of the most important basic skills of programming!
Learn the sequential table and linked list, you know, in the query operation of more programs, you should use the sequential table, and modify the operation of more programs, you want to use the linked list, and one-way linked list is not convenient to do, every time is good trouble ah, how to do? You will then think of a doubly linked list or a cyclic list.
After learning the stack, you know, a lot of problems involved in the first out, such as function recursion is a stack model, Android screen jump to use the stack, a lot of similar things, you will be the first time to think: I will use this thing to write algorithms to achieve this function.
After learning the queue, you know, for first-in first-out to queue up the problem, you need to use the queue, such as multiple network download tasks, how can I dispatch them to obtain network resources? How do I allocate resources (like CPUs) to multiple tasks, such as the operating system's process (or thread) scheduling? Must not all have all together, the resources only one, then must queue! So how do you line up? With a normal queue? But what about those high-priority threads? That's too communist, then, you'll think of the priority queue, how to implement the priority queue? With heaps, and then you have questions about what the heap is? Check it yourself, knock tired.
Anyway, it's right to learn the data structure well. I think the data structure is equivalent to: I plug the teeth, then the use of toothpicks this "data structure", of course, you can use nails, but "performance" is not so good; I want to screw the nut, certainly with a wrench this "data structure", of course, you can use pliers, but also not so useful. Learning data structures is to understand what tools are needed to move bricks in the IT industry, and what are the pros and cons of these tools, and what scenarios should they be used for? Later in the process, you will find that these basic "tools" also have some flaws, you are not satisfied with the tool, at this point, you begin to transform themselves on the basis of these data structures, which is called a custom data structure. And you'll build a lot of other data structures that apply to real-world scenarios. You use these data structures to build wheels, unconsciously, you become another wheel brother. Simply put, you go to learn python, to work, a slightly higher load of the Python site, you do not understand the data structure, you do not know how the List and Dictionary performance curve will probably change, need depth optimization when how to do.
You are a freshman, do not be deceived by those impetuous remarks. Read a good book and lay the groundwork. Data structure and algorithm is a history of development, they are invented to "make things", learning they are to not reinvent the wheel, when you "do things" encountered in the operational efficiency of the bottleneck, you can refer to these predecessors, when the completion of the study, you can evaluate a "thing" with the current technology is possible to make
Someone listed XX structure, XX algorithm can do what is all fart words, books have. Plainly this is the former formula, learning is to set the formula to solve the problem, solve the world's problems will be invented new formula (algorithm/structure)
Can be done to include two points: whether the efficiency can be sustained, whether the function can be achieved
Some languages have packed a number of basic algorithms for fast implementation, and general efficiency is acceptable.
When efficiency is unacceptable, you need to adjust the algorithm and structure, c even assemble
The master should be the one who wants to see something that can be seen, so you should choose a language with a high level of abstraction. What do you want to do with this "thing"? Split all the details to be fulfilled, one by one, when it works and as expected, it's done.
Is it necessary to learn more about the efficiency needs of your implementation process TOKUMX | Tokudb
Is "The data structure learns well" the rich example. As far as I'm concerned ... I think one of the most useful things I know about freshman year is this:
Want to do their own things, want to do their own application, do not think about its immediate use.
As far as the data structure is concerned, you may start to think that this thing has not been able to write any application for half a day and has no real value. In fact, it's worth more than any of your programming language syntax.
You can master 10 languages, understand a variety of design patterns, various frameworks, but less data structure, you will never go far, like a hundreds of kinds of house design drawings of architectural designers, you can not design the Burj Khalifa.
Many people think that undergraduates do two small projects, take a few outsourcing, do a few apps, engage in their own blog is very powerful, in fact, if you are confused by this thing, then, your level is here.
The engineer is not a casual move to be able to be, undergraduate is not a training school. You look for things only to traverse the data structure, you can let the program run a bit faster chant.
Recently and Telerik struggle for a long, various optimizations, various modifications of its code, the implementation of its internal open a hole, good to take over its data structure, and then provide their own implementation, that performance is rubbing to improve.
Also thanks to Telerik for the poor quality of the code, can have sufficient space to play their own value, to win the boss's favor. I think the data structure is the second layer in programming.
The first layer is abstract and abstracts the things you want to describe in a procedural language. For example, a person, you should use what kind of storage, this is the first layer of abstraction.
The function of a data structure is how to organize it together.
Why organize your data? Because the computer does not understand your abstraction, it does not know that this person's father is him, brother is he, you have to program ape to tell it. Why not know, because the computer only 0 and 1, the data are 0 and 1, the node and the relationship between the node, how the two get to each other, this is what the programmer to do, the data structure teaches. Because the computer does not know how to do it.
The algorithm is how to transfer the state and state between nodes and nodes. First of all, learning data structure is very useful, it is an important basic skill for computer practitioners.
Every year, computer science graduates so much, how to distinguish between elite and ordinary yards of a very important measure of the professional skills is not enough solid.
The following on the data structure in the professional role, I say my opinion.
In some specific cases, the language provides the basic data structure (for example, int,char,string ... Does not meet your needs, this time you need more advanced data structures to cope with these situations. Like martial arts moves, you use the basic moves, you need to learn more lethal use of more extensive moves.
Equivalent to the basic martial arts level two moves.
When you understand these moves, like linked lists, stacks, binary trees, graphs and so on, you can use a more profound confidence to face the computer world, you can know that the network of nodes connected to each other is a concrete example of the diagram, you can use the shortest path algorithm to find the actual network node to another node of the shortest path, You can know that the vast amount of files in the operating system can be organized by b+/b-tree, you can know that the process management can use priority queue (heap) to schedule the process with priority, you can know that the function of the call is the operation of the system stack.
In short, you can deepen your understanding of the computer world.
On the other hand, some data structures can improve the user's efficiency in certain environment.
For example, using a binary tree to find, tree structure in the search for a big advantage is to reduce a lot of unnecessary search. When you press the left small right large (the left half of all the number is less than the middle number, the right half of all the number is greater than the middle number) of the way to organize a sequence of two tree, you can only and the middle of the number of the comparison, shrinking the range can be found you are looking for the number. So obviously it's much faster than a sequential lookup.
When you finish learning the data structure, you will also have some understanding of the algorithm, because the data structure and algorithms are often not separated, the algorithm often requires specific data structure support.
The algorithms of the Yaotu are almost all supported by the data structure.
If the data structure is a two-level moves, or the scope of the basic internal strength, is auxiliary, then the algorithm is the naked big kill device, it can be used purely to improve the efficiency of the program (here is the narrow algorithm).
When you match the string, the algorithm is replaced with KMP, and the time complexity is immediately amplified from O (n^2) to the linear O (n), the acid cool, and the operation of the cumbersome sequence matching, not the same.
Say so much, you also probably understand the data structure and the importance of the algorithm, so my suggestion is, first lay a good foundation, step by step slowly, hit the lower building, can base up lofty high-rise, June do not see the Tofu slag project is how harm oneself. Data structures can help you quickly define objects and implement algorithms when you are analyzing your business!
Other business to tell you clearly, you know can be achieved, coding is another thing!