Preface to the new book "algorithms-principles hidden behind data structures", data structures and algorithms

Source: Internet
Author: User

Preface to the new book "algorithms-principles hidden behind data structures", data structures and algorithms

Preface to the book "algorithms-principles hidden behind data structures"

In the winter of 2014 AD, a biography of the legendary life of Alan Turing, the father of computer science, was released in the United States. This film is "Imitation Game". In the following year, the film won the 87th Oscar for Best edit script award and seven nominations, including the best film, the best director, the best actor, and the best actress. Although modern computers are everywhere, since the Turing age is too long ago, there are very few people who know about his research work.

To talk about Turing's contribution, we have to push the time forward. In this important speech, German mathematician David Hilbert gave a speech entitled "mathematical questions" at the International mathematician conference held in Paris on 1900, he raised 23 well-known questions about Hilbert. Although the subsequent development of mathematics far exceeded Hilbert's expectation, his 23 questions still play a very positive role in promoting the development of mathematics in the 20th century.

The 10th question of Hilbert is to design an algorithm to test whether the polynomial has an integer root. He did not use the term algorithm, but used the following statement: "A process can be determined by a limited number of operations ". Interestingly, from his statement on this issue, we can see that he explicitly requires the design of an algorithm. Therefore, he apparently assumes that such an algorithm exists, and all people have to do is find it. Now we know that this task cannot be completed, that is, it is unsolvable in algorithms. However, for mathematicians in that period, it was impossible to draw such a conclusion based on their intuitive understanding of the algorithm.

In other words, an algorithm is a simple instruction set constructed to implement a task. In everyday terms, algorithms are also called processes or methods. Algorithms also play an important role in mathematics. The ancient mathematical literature contains algorithm descriptions for executing various computing tasks. For example, the ancient mathematical classical chapter 9 arithmetic describes many algorithms, including finding the maximum common divisor, the least common multiple, the square root of an open cube, and the root of an open cube. Modern computer science is full of algorithms. For example, you can use the Shortest Path-based Dirichlet distribution algorithm and the string-matching KMP algorithm.

Although algorithms have a long history in mathematics, the concept of algorithms has not been precisely defined before the 20th century. Mathematicians are helpless in the face of Hilbert's 10th problems. Due to the lack of precise definitions of algorithms, it is impossible to prove that a specific task does not have an algorithm. To solve the 10th problems of Hilbert, people have to wait for the precise definition of algorithms.

Until 1936, sugon appeared. Turing submitted a paper entitled "application of digital computing in decision-making difficulties" to the magazine of authoritative mathematics in London. This article was officially published in 1937 and immediately attracted wide attention. In this paper, Turing describes a machine that can assist in mathematical research, that is, an abstract system later called a "Turing Machine. At the same time, another mathematician, aronzo Qiu Qi, also independently proposed another system, the so-calledLambdaAlgorithm. Turing uses his Turing Machine to define algorithms, while Qiu Qi usesLambdaCalculation to define the algorithm. Later Turing proved that these two definitions are equivalent. As a result, people establish a connection between the non-formal concepts and precise definitions of algorithms, that is, the intuition concepts of algorithms are equivalent to those of the Turing Machine algorithms. This is the so-called Qiqi-Turing topic.

The algorithm definition proposed by Qiu Qi-Turing is necessary to solve the problem of Hilbert 10th. However, the true solution to the 10th issue will wait until 1970. Thanks to the outstanding contributions of Qiu Qi and Turing, matthiassavi is working on the basis of the work of Davis, pupnam, Robinson, and others, it is proved that the algorithm for checking whether the polynomial has an integer root does not exist.

Since Turing, algorithms have already had an inseparable connection with computer science. Of course, the content of this book is not intended to begin with the Turing machine. Looking back at the history of establishing a formal algorithm definition and cracking the question of Hilbert 10th, we want to explain more about how important algorithms are to our world.

Whether you are an information technology practitioner, a computer student, or a professional researcher, it is important to master a computer language. But what if I can write beautiful programs without having mastered the syntax rules? Of course, the answer is no. Because you also need another tool that is at least equally important-algorithms. The relationship between algorithms and languages is actually like the relationship between "Tao" and "skill. Mastering a language is like learning a skill and can become a craftsman. However, if you want to jump from a craftsman to a master, it is obviously not enough to stay at the "skill" level. What's more important is to realize the "Tao ". Algorithms are undoubtedly the "channels" in computer programming ".

When talking about the importance of algorithms, we have to mention a study conducted by computer scientist Andrew aipell in 1985, which is also a classic case in the field of program performance optimization. At that time, epel compiled a program for calculating the interaction between the Zhongtian bodies in the gravity field. Given conditions such as the object quality, initial position, and velocity in the field, the program can simulate and simulate the running status of two of the 10000 celestial bodies when they interact with each other. Because the calculation workload is too large, it takes about one year for the initial program to complete the calculation. After a series of improvements, epel eventually reduced the program time to a day! In this improvement process, algorithms and data structure optimization account for the main proportion.

Let's talk about an example that happened to me. At school, the teacher assigned a programming assignment. It is used to simulate a game with three-fold guesses. A three-chord refers to A melody composed of three voices, A, B, C, D, E, F, and G, each sound has three conditions: high-pitched, moderate, and low-pitched (represented by 1, 2, and 3 respectively ). Now suppose a composer has a favorite melody, and then a piano player tries to guess the answer. Every time the player gives a guess, such as "A1, B2, C3 ". Then the composer will be able to answer only a few of the fully guessed tones (I .e., the notes and sounds are both right). Apart from the fully guessed tones, the song guesses a few and the pitch guesses a few. Then the player continues to guess until it is completely guessed. You know, there may be a total of 1330 million guesses! We hope that the less the number of times we use, the better. I don't know whether the readers of this book have come up with any methods to solve this problem. However, the program I finally implemented can achieve an average of 4.2 times to guess the answer. In this process, designing an excellent algorithm is undoubtedly the best choice.

Speaking of algorithms, we have to mention the data structure. The two are mutually reinforcing and inseparable. On the one hand, algorithms must be implemented with the corresponding data structure. On the other hand, when we define a data structure, we have also defined operations related to it. The steps of these operations are algorithms.

In general, this book focuses on the topic of algorithms and data structures, this article introduces more than 40 typical algorithms (including pattern matching, sorting, hash, and shortest path) commonly used in modern computer technology in a simple and progressive manner ), and algorithm design ideas such as backtracking, divide and conquer, greedy, and dynamic planning. This book also systematically explains linked lists (including one-way linked lists, one-way cyclic linked lists, and two-way cyclic linked lists), stacks, and queues (including common queues and Priority Queues) common data structures, such as tree (including binary tree, Harman tree, heap, red/black tree, AVL Tree, and dictionary tree), graph, set (including non-intersection, and so on), and dictionary. At the same time, by explaining 22 classic issues (including the Joseph Ring issue, the tower issue, the eight queens issue, and the knight travel issue), we will gradually unveil the algorithm principle hidden behind the data structure, it aims to help readers consolidate their knowledge reserves, activate their thinking skills, and ultimately break through the barriers that impede the improvement of programming capabilities.

On the paper, you may have to learn more about it. Refining the ability to use data structures and deepening understanding of algorithm ideas all depend on programming practices. This book uses C ++ as the description language and provides implementation code for all involved data structures and algorithms for your reference and learning. The code is compiled in the TDM-GCC ++ 5.11 and VisualStudio 2013 environments based on DEV-C 4.9.2. You can. You are also welcome to discuss the issues and deficiencies in this book with me. Please leave a message in the above blog.

Self-knowledge theory must be thought-provoking. Due to limited time and ability, the book is inevitable. I sincerely hope that readers and experts will not criticize and correct each other.


Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Related Article

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.