10 basic and practical algorithms that programmers must know
Top 10 classical practical algorithms that programmers must know
The programmer's practical algorithm is C or C ++. I also hope that you can recommend a good C ++ Data Structure book.
Algorithms do not belong to a specific language. They generally use pseudocode to express logic. In what language do you use, you can convert this pseudo code into the specific implementation code of that language, however, the algorithm logic remains unchanged.
Some classical algorithms in the programming field are also required by programmers.
This is what I saw in a forum. For more information, see. C ++ virtual functions
======================================
C ++ uses virtual functions to realize the polymorphism of its objects. The first four bytes of the C ++ object are pointers to the virtual function table. The initialization sequence is the first base class and then the derived class, therefore, the virtual function table always points to the last derived class, so as to implement different behaviors of the same function in different objects, so that the objects have both common and personalized characteristics.
Partner Algorithm for memory pool allocation and recovery
======================================
The partner algorithm is an enhancement algorithm of the idle linked list method. 2 ^ 0 \ 2 ^ 1 \ 2 ^ 2 \ 2 ^ 3 is created in sequence... 2 ^ n-sized idle linked list of memory blocks, using the partner nature of adjacent memory blocks, it is easy to move the memory blocks of mutual partners to the corresponding idle linked list or split one piece of memory into two partners' memory blocks for allocation, and the other to the corresponding idle linked list, this makes memory allocation and recovery efficient.
AVL Tree
======================================
AVL Tree is a balanced binary tree, where sequential traversal is sorted from small to large. This structure is highly efficient for inserting nodes and searching, and is widely used.
Quick sorting
======================================
Data to be sorted is divided into two independent parts by one sort. All the data in one part is smaller than all the data in the other part, then, sort the two data parts by using this method. The entire sorting process can be recursive to convert the entire data into an ordered sequence. High Efficiency
Asymmetric encryption protocol for Cryptography (Public Key and private key encryption protocol)
======================================
Asymmetric encryption algorithms require two keys, one of which is the ciphertext generated by encryption. They can only be decrypted by another key. Key Holder A can publish one of them, which is called A public key, another secret is known as the private key. When B wants to send A secret message to A, he or she only needs to use the public key of A to encrypt the secret, you can safely use various channels to send superstition to A, because only A can decrypt the encrypted message, and the third party can intercept the message because it cannot be decrypted and meaningless.
This algorithm solves the problem of Secure Key transfer, because both the public key and encryption algorithm are public, and the private key does not need to be transmitted.
Digital Signature Protocol for Cryptography (identity authentication and anti-repudiation)
======================================
The digital signature is also based on asymmetric encryption. If A Jun uses its private key to encrypt the file and publish it, A Jun cannot deny that the file was published, if the algorithm is reliable, the file must be encrypted by A Jun using its private key.
Since the encryption and decryption of asymmetric encryption algorithms are slow, the digital signature is not to encrypt the information to be published with its private key, but to use a single hash algorithm such as (MD5) A relatively short fingerprint (hash value) that generates this information. The fingerprint is encrypted with its private key and published together with the information, which also achieves anti-denial.
Non-backtracking string pattern matching-kmp Algorithm
======================================
Based on the characteristics of the substring, when the matching fails, the substring is directly moved back to several bytes to continue matching, greatly improving the matching speed. This algorithm is widely used. For details, see the data structure tutorial.
Minimal Path Selection-dijela algorithm and freuch Algorithm
======================================
When learning the data structure, the most impressive thing is to calculate the kmp algorithm and the minimum path algorithm, because it is hard to understand them. I cannot invent these algorithms, and they are all talented people, haha.
The shortest path algorithm has helped people write a small thing. It is still very effective. Remember to use a variant of the freuch algorithm. If you want to know more about it, you can find relevant information, if you want to use them in your project, you just need to copy the code from the textbook without understanding it.
Tcp-nagle Algorithm
======================================
There are many amazing ideas in TCP/IP, and the most impressive is the nagle algorithm.
Tcp out of efficiency and traffic control... the remaining full text>