Marathon algorithm:The marathon algorithm is used to calculate the longest palindrome string in a string (symmetric strings, such as Aba Abba).First, we get a string s and then add # to each character in S.Example: s= "ABCB" t= "a#b#c#b"Each of our T-strings t[i] extends D characters so that T[i-d,i+d] is a palindrome string. You will immediately find out that D is the length of the longest back character string centered on T[i.We create a P array, wh
This is my algorithm learning tag under the first essay, first I want to declare, after reading a lot of blog, my idea is, try not to blindly copy other people's Things, one reason is that the blind copy may not be able to find the errors in their articles, the second is to deepen their understanding of the level, and the blog is easy to read, Reprint other people's Things must be annotated source. And one of my habits is to write something short, so
The LCS problem is a classic problem of dynamic programming, and it is also considered an entry problem. The goal is to require the longest common substring of two strings. For example the following two strings:
string 1:abcbdab
string 2:bdcaba
So, their longest common subsequence is BCBA. Note that the longest common subsequence is not the longest public string, the longest public string in Leetcode seems to have such a problem, with the method of brute force can be calculated in a very short p
This article simply draws a chessboard, through the input coordinates (format example: 3,4) to play chess, then is the Victory judgment algorithm. My first algorithm will be the array of cross-border problems, that is, when the chess pieces on the side of the most side of the array will appear on the side of the exception, and then changed the big change, solve the problem. The following is the correct code
Please cherish small compilation of labor results, the article for the small series of original, reproduced please indicate the source.
Scan (SCAN) scheduling algorithm: Always start from the current position of the magnetic arm, along the direction of the movement of the arm to select the closest to the current boom of the cylinder visitors. If there is no request to access along the direction of the magnetic arm, the direction of movement of the ma
In the field of pattern recognition, the nearest neighbor Method (KNN algorithm and K-nearest neighbor algorithm ) is the method to classify the closest training samples in the feature space.
The nearest neighbor method uses the vector space model to classify, the concept is the same category of cases, the similarity between each other is high, and can be calculated with a known category of cases of similar
Using JS implementation of the Banker algorithm, download the address: Https://git.oschina.net/maleic/mybanker.
Usage: Download and extract the index.html file in the browser, and then open the interface as shown:
By filling in the max and allocation arrays, you simply select the process to request resources and the number of resources requested, and then click Run to perform
For example, select the process to request a resource for the P
Turn from: http://blog.csdn.net/wallwind/article/details/49701397
Before someone asked me to design a distributed incremental unique ID generation. Think for a long time do not know, occasionally a colleague said Snowflake algorithm, I Baidu a bit, very simple and efficient.
Reference
Https://github.com/twitter/snowflake
So, I use C language casually realized a bit, has not reached the industrial level, the need for refinement, but the basic can be u
Select sorting algorithm
definition
Searches the entire array, finds the minimum element, and swaps it with the element at the top of the array, then finds the minimum element in the range of the first element and swaps it with the element at the top of the array, repeating until the last element of the array terminates.Complexity of Time
O (n^2)
Code
public class Selectionsort { public int[] Sort (int[] a) { int te
MP = 0;
int index = 0; fo
As previously said, the exposure to the extended Euclidean algorithm is due to the fact that the Swust OJ Frog's Date II (0481) http://www.cnblogs.com/haveyoueverbeen/p/4483218.html (View the title information can be stamped above the address)Problem Solving Ideas:Set the output to S, then (m*s+x)-(n*s+y) = KL (k∈z), i.e. (N-M) *s + KL = x-y, set a=n-m,b=l,c=x-y, i.e. as+bk=c (ax+by=c), the smallest positive integer x is obtained, and then a set of so
The algorithm is based on an integer array, when p and Q are connected only if the p and Q elements are equal. initially, the value of element I in the array is i,0merging of P and Q, we iterate over the array and change the value of all elements named P to Q. We can also choose another way to change all the elements named Q to P.The program reads a non-negative integer pair sequence that is less than n from the standard input (to P-q, "connect the ob
First, the dictionary order method1) from the right end of the sequence p, scan to the left until you find the first number that is smaller than the number on the right.2) from the right, find all the smallest numbers in the larger number, ie.3) Exchange with.4) Flip the sequence on the right to get the next permutation of the dictionary order.5) Repeat the above steps until you get the largest order in the dictionary order, that is, the left number is larger than the right.Second, SJT algorithm
Your friendあほう is online. Network flow I watched it for three days before I saw it ... The unanimous suspicion of life is not to learn the algorithm, stupid will be stupid to die me.I saw it later. Maximum flow (network flow basic concept + three algorithms) This is the only understanding, ah ~そっか~Mainly do not understand the reverse side, the above blog is very detailed.So what do I do with this blog post? (Probably the upper body of the play)On the
0. Foreword
Whether a string "Bbcabcdababcdabcdabde" contains another string "Abcdabd". KMP is one of the most common string matching algorithms. KMP has excellent time complexity O (m+n), the internet has a lot of KMP algorithm explanation, but read all very laborious. I didn't really understand this algorithm until I read Jake Boxer's article. Below I use my own language, try to write a comparison underst
Label
Test the line detection function by using the Hough transform algorithm.
[Email protected]
Http://blog.csdn.net/kezunhai
Hof transform is one of the classic algorithms in image transformation. It is mainly used to separate geometric shapes (such as straight lines and circles) with the same features from images ). Compared with other methods, the HOF transform method for finding a straight line and a circle can better reduce noise interference.
can start with the nether Ω (N), the upper bound O (n^2), and then gradually converge to (NLOG2N)
Detail correction
Sometimes the guessing solution is correct, but the mathematical induction does not directly prove its details, because the mathematical induction is not strong enough to prove its details.
a lower order can be subtracted from the guess solution to satisfy the mathematical induction method.
Avoid traps
Similar to the summation mathem
This algorithm is the full version of the prim algorithm. Specific prim algorithm analysis see http://blog.csdn.net/yeruby/article/details/38615045
/************************ author ' s email:wardseptember@gmail.com date:2017.11 ************************/#include
If you have any errors above, please point out immediately and I'll correct them immediately.
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.