[LeetCode] - stack and queue
preface
When I first know LeetCode and algorithm, I will record my algorithm learning experience in this series of articles. In the early stage, I mainly supervise my learning and clock in. In the later stage, I will slowly add my understanding of knowledge to the articles. I hope you can gain something from reading my articles. The order ...
Added by roscor on Fri, 11 Feb 2022 22:53:55 +0200
Code Capriccio record brush problem introduction binary tree notes
Code Capriccio record brush problem introduction notes
Code Capriccio introduction Code Capriccio record brush problem introduction notes
1. You should know this about binary tree!
Handout address
Binary tree code
public class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode() {
}
TreeNode(int val) ...
Added by only one on Fri, 11 Feb 2022 20:55:51 +0200
[data structure algorithm] - C language
The data structure algorithm implemented in C language is explained one by one below:
(Swap function is a transposition function at the end, which can be understood)
1. Insert sorting
As the name suggests, a value is inserted one by one from the front. When inserting, it is sorted once. If there are n numbers, it is sorted n times
Th ...
Added by tomharding on Fri, 11 Feb 2022 20:18:56 +0200
Section 4.4 of algorithm notes - preliminary algorithm - > greedy
A watch TV
Title Description
When the summer vacation comes, Xiao Ming can finally watch TV happily. But Xiao Ming likes too many programs. He hopes to see as many complete programs as possible. Now he gives you the broadcasting schedule of his favorite TV programs. Can you help him arrange it reasonably?
input
The input contains multip ...
Added by madwormer2 on Fri, 11 Feb 2022 20:09:40 +0200
String matching algorithm
Title: give you two strings, haystack and need. Please find the first position of the need string in the haystack string (the subscript starts from 0). If it does not exist, - 1 is returned. 0 is returned when {need} is an empty string.
leetcode: https://leetcode-cn.com/problems/implement-strstr/
Premise of problem solution
This question ...
Added by Stagnate on Fri, 11 Feb 2022 19:45:46 +0200
leetcode 93. Recover IP address [backtracking]
1. Subject requirements
leetcode 93. Restore IP address
The valid IP address consists of exactly four integers (each integer is between 0 and 255 and cannot contain leading 0). Use '.' between integers separate.
For example, "0.1.2.201" and "192.168.1.1" are valid IP addresses, but "0.011.255.245", "192.16 ...
Added by fiddler80 on Fri, 11 Feb 2022 18:23:59 +0200
Kruskal algorithm & & joint search set
now let's talk about another method for finding the minimum spanning tree - Kruskal algorithm. We know that there can be no loop in the minimum spanning tree, so we skip when we encounter the edge forming the loop, but how can we until the loop is formed? At this time, we need to judge whether the two vertices are connected. ...
Added by stockdalep on Fri, 11 Feb 2022 14:19:33 +0200
AVL tree - balanced binary tree
catalog:
I Concept & principle
Previously, we understood the binary search tree, but we found that if the data is orderly or close to orderly, the binary search tree will degenerate into a single tree
AVL tree is a balanced binary tree. It just adds a balance factor to the binary search tree to form the current balanced bi ...
Added by cbrknight on Fri, 11 Feb 2022 13:19:17 +0200
KMP algorithm (string matching)
String matching is a common algorithm problem. There is a string to judge whether it contains another string.
For example, there is a string "aaaaabc" (main string). I want to know whether it contains another string "AAAB" (mode string)? Match the main string and pattern string.
First, compare the first character of the s ...
Added by robs99 on Fri, 11 Feb 2022 13:11:47 +0200
Meisai 8: simulated annealing algorithm, genetic algorithm, particle swarm optimization algorithm (intelligent algorithm)
catalogue
First, Simulated annealing algorithm (SA).
1. Basic theory of SA
2.SA solves the maximum value of the function
3.SA toolbox
2, Genetic algorithm (GA)
1. Theoretical basis of GA
2.GA solves the maximum value of function
3.GA toolbox
3, Particle swarm optimization (PSO)
1. Knowledge of PSO algorithm
2.PSO algorithm design
3. ...
Added by justphpdev on Fri, 11 Feb 2022 11:54:03 +0200