Data structure life from scratch - array and pointer basis (including personal in-depth understanding)
Freshmen enter the data structure. Please give advice on mistakes and omissions and make progress with you.
Arrays and pointers
What is an array
A contiguous space (clearly telling the compiler how many blocks of space there are) is used for the same type of data The name of the array is for the user to see. In the actual memory, the ad ...
Posted by Morbid on Sun, 30 Jan 2022 16:22:55 +0100
Data structure and algorithm -- hash table and string
1. Preparatory knowledge
1.1 simplest hash - count the number of characters
1. Title Description
Enter a string and output the number of each character in the string For example: simple_hash(“abcdefgaaxxy”) Output: [a][97]:3 [b][98]:1 [c][99]:1 [d][100]:1 [e][101]:1 [f][102]:1 [g][103]:1 [x][120]:2 [y][121]:1
2.C + + co ...
Posted by Hardwarez on Sun, 30 Jan 2022 14:21:59 +0100
Sorting algorithm summary
Sorting algorithm summary
I Exchange sort
1. Bubble sorting Principle: compare the adjacent elements. If the former is larger than the latter, exchange them. Do the same work for each pair of adjacent elements from front to back. In this way, after a bubble, the last element is the largest number. In this way, each bubble determines the pos ...
Posted by DragonFire-N[R] on Sun, 30 Jan 2022 11:18:12 +0100
6 questions to solve the monotonous stack problem
Next larger element 1
Title Link Maintain a monotonically decreasing stack, that is, when the traversal element is larger than the top element of the stack, save the result and pop up the top element of the stack In order to get the results in the order of subset array 1, we need to use hash table to establish mapping relationship when ...
Posted by Desai on Sun, 30 Jan 2022 08:33:26 +0100
Double pointer algorithm - Introduction to the algorithm
Double pointer algorithm - Introduction to the algorithm
Overview of double pointer algorithm
The double pointer algorithm should be a special traversal algorithm, which not only uses a single pointer to traverse, but uses double pointers. Note that the pointer here does not refer to pointers such as int *ptr. The double pointer algorithm can ...
Posted by clearstatcache on Sun, 30 Jan 2022 08:29:01 +0100
Heuristic A * algorithm to solve the shortest path problem
A * algorithm:
In the process of search, an evaluation function is used to evaluate the current point, find the best state and search until the target is found. The evaluation function F(x)=G(x)+H(x), where G(x) is the actual cost and H(x) is the heuristic function, which is heuristic. And the heuristic function should meet: H(x) < = H*(x), ...
Posted by delassus on Sun, 30 Jan 2022 07:15:25 +0100
Finding the longest common subsequence in C++/python
C + + finding the longest common subsequence
1. Transverse scanning
2. Longitudinal scanning
Problem solving ideas If there is no string, an empty string is returned; If there is only one string, return itself.
Otherwise, take strs[0] as the standard and compare the remaining strings one by one for each character. If it is found that the ...
Posted by islan on Sun, 30 Jan 2022 06:44:11 +0100
Conjugate gradient method of positive definite quadratic function of optimization method and its implementation (based on Python)
The conjugate gradient method is also one of the conjugate direction methods, but it reduces the search amount of the gradient direction. It directly takes the gradient direction passing through the minimum point of one-dimensional search as our search direction, so it has a certain improvement in the calculation speed. If you are confused abou ...
Posted by ajmoore on Sun, 30 Jan 2022 04:46:20 +0100
Adjacency matrix representation of graphs (Java)
1, Basic knowledge understanding
(I have some colloquial explanations + Baidu subject explanations. Please consult the literature for professional explanations. I compiled the introduction graph theory of Discrete Mathematics (Fifth Edition) through Qu Wanling, Geng Suyun and Zhang Linang. This book is a rare good book for introductory compute ...
Posted by BLeez on Sun, 30 Jan 2022 00:36:37 +0100
Jianzhi Offer interview question: 09 rebuild binary tree
The algorithm is not the hard core "Nine Yang Sutra" in Jin Yong's martial arts novels, nor the lightweight "Lingbo micro step" ", which is the basic skill of programmers, just as people who practice martial arts need to take a horse step. Whether the Kung Fu is good or not depends on whether the horse step is not solid ...
Posted by icedude on Sat, 29 Jan 2022 23:58:27 +0100