Write algorithms step by step (the opening part)

Source: Internet
Author: User

People who really learn computer science (not just programmers) have considerable accomplishments in mathematics. They can use the rigorous thinking of scientists to prove their knowledge, engineers can also be used to solve the problem. The best way to interpret this thinking and method is "algorithm ".

Despite Moore's Law, the computing power of computers is growing rapidly every year, and the price is also declining. But we should not forget that the amount of information to be processed increases exponentially.

The requirements of applications are ever-changing. In many cases, you need to break down a complex problem into several simple and small problems, and then select appropriate algorithms and data structures.

In the Internet era, even the best algorithms must be executed in a parallel computing environment. When traditional parallel algorithms run, the efficiency will quickly decrease after increasing the number of machines. That is to say, if ten machines have five times the efficiency, up to one thousand servers may only have dozens of times the effect. No company can afford this. In addition, in many parallel algorithms, as long as a node makes a mistake, all computing efforts will be exhausted.

So how does Google develop efficient and fault-tolerant parallel computing? Jeff Dean, Google's most senior computer scientist, recognizes that the vast majority of data processed by Google can be attributed to a simple parallel algorithm: map and reduce. This algorithm can achieve high efficiency and scalability in many kinds of computing (that is to say, even if the number of one thousand machines cannot reach one thousand times, at least hundreds of times ). Another major feature of MAP and reduce is that it can use a large number of cheap machines to form a powerful server farm. Finally, its fault tolerance performance is exceptionally good, even if a server
Machines in farm are half broken, and the entire farm can still run. It is precisely because of the knowledge of this genius that the map and reduce algorithm is available. With this algorithm, Google is able to increase computing workload almost infinitely and grow with the ever-changing Internet applications.

 

Seven suggestions for programmers:

1. Internal skills

Do not spend only time learning a variety of popular programming languages and tools, as well as the subjects required by some companies to recruit advertisements. Basic courses such as data structures, algorithms, databases, operating system principles, computer architecture, computer networks, and discrete mathematics should be well learned. You may try the questions in the art of computer programming written by Gartner. If you can solve most of these questions, it means you have a certain skill in algorithm.

2. Multiple practices

Accumulate experience and consolidate knowledge through practical programming. Many Chinese university graduates lack programming and debugging experience. They have learned how to pass the C language and pass the examination. In the project, if the program can be compiled, run, and the input and output meet the requirements, it is okay. These practices are not acceptable. When writing a program, you must think about how to write the program more refined, efficient, and high-quality. It is recommended that you strive to accumulate 100,000 lines of code in the four years of college. What we must understand is that good programmers did not learn it.

3. Be realistic

Do not underestimate any practical work, such as seemingly simple coding or testing. We need to persistently pursue meticulous practices and professionalism for details. I have found that many programmers have a superficial understanding of knowledge. They do not have to worry about it. For example, after learning C ++, do you know how an object is initialized in assembly code after compilation? How are the members of this object stored in the memory? When a member function is called, what additional actions does the compiler add to the assembly code? How is a virtual function called? These things are not mentioned in detail in programming languages or compilation principles. They can only be mastered through practical work.

4. Focus on Mathematics Learning

Mathematics is the gymnastics of thinking, and mathematics is everywhere. To learn computers, you must at least learn Discrete Mathematics, probability theory, Boolean algebra, set theory, and mathematical logic. This knowledge is not difficult, but it will be of great help to your future work. Especially when you are interested in some "mathematical-intensive" fields such as video and image processing, this knowledge will become a powerful tool in your hands.

5. Cultivate team spirit and learn to cooperate with others.

Today, software engineering is no longer available for individual operations, but can be successful only by teamwork. People who do not know how to work together cannot be a big tool. We should look for opportunities to develop projects with people.

6. inspire innovation consciousness and never stick to it.

Without mastering the fundamental principles of a certain algorithm technology, we will not be able to respond and innovate. To be a good programmer (in fact, this is true for any industry), it is important to develop a good habit of research, curiosity, innovation, hands-on, and cooperation, which is not satisfied with the duck filling, it is not satisfied with the examination delivery, not satisfied with the appearance. This is not just a matter of course.

7. Work with strategy

Find a meaningful summer job or part-time job without affecting your studies. Find a technology-oriented company and complete the programs that will truly be used by users under the guidance of a good "Boss. Don't rush to a place where you want to be "head" and stand alone, because learning from others is your purpose. The same is true for finding a job. You should not only look at the treatment and title, but also select an environment where you can learn, an enterprise that is willing to train employees, or a professional company that attaches importance to you. Finally, we need to pick a good boss.

I hope everyone can seize the opportunity to develop good learning habits and thoroughly learn algorithms. I hope everyone can have a bright future!

 

The algorithm is the soul, and the program is the clothing.

Ling xiaoning: "General domestic development enterprises and developers are impetuous and lack solid basic skills, which directly leads to their ability to independently innovate ". In the modern sense, the concept of computer algorithms was clarified after Alan Turing proposed the basic model of modern computers in 1936: algorithms are the process of solving problems or executing tasks; it can be executed step by step on a Turing machine or an equivalent machine (such as a modern computer. Typical problems of algorithm research include: The most common classification, sorting, search, traversal, and set operations in computers. Common algorithm design methods include loop, recursion, grouping, dynamic planning, linear planning, search and enumeration.

The main analysis method of an algorithm is to establish a mathematical formula corresponding to the algorithm to calculate the running time and storage space used by the algorithm (called algorithm performance analysis ). Through such rigorous mathematical training, we can obtain an intuitive ability to estimate the algorithm performance. This capability is widely used by Microsoft software.

A student told me that his ideal is not to be a programmer but a software architect. I said: Being an architect is a good ideal, but not a programmer. Being an architect is not an ideal or an illusion. I know that architects, including Microsoft's chief architect Bill Gates, and the chief architect of Windows and Office software, were once the best programmers. Software Architecture design requires a solid foundation (including algorithm basics) and rich experience, not just drawing some diagrams to write some processes.

If you find a good method, learning the algorithm basics is not very difficult. Here, I will give you four suggestions:

First, learn relevant mathematics first. Advanced algebra is the most commonly used algorithm analysis and must be mastered. Boolean algebra, set theory, and permutation and combination in discrete mathematics are the foundation of algorithms. Mathematical logic or formal logic teaches you the reasoning and proof methods, which is helpful for establishing algorithm performance formulas and algorithm performance analysis. The Limit Theory in calculus helps you better understand algorithm performance formulas.

2. Discuss that computer algorithms cannot be separated from data structures. Therefore, data structure is the basis of learning algorithms. Some universities put algorithms and data structures together, which is a feasible method.

Third, learning methods is more important than remembering conclusions! Several common methods for designing algorithms, such as loop, recursion, grouping, search, dynamic planning, and linear planning, are the most common methods in programming. They are all the "panacea" that can be used in programming ", it should be the focus of algorithm learning.

Fourth, like other software courses, the best way to learn algorithms is programming exercises. Find a question that you are most interested in, design several different algorithm solutions, derive performance formulas for each algorithm, and compile programs for each algorithm, run these programs and calculate the actual performance, compare your theoretical and actual results, and finally make an analysis. This process can help you build a solid foundation for Algorithm Programming and cultivate your intuition on the algorithm and its performance. Both are extremely important to programmers.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.