Link list inversion of LeetCode daily question

preface: Hello, everyone. Today is the eighth day of LeetCode's daily question. What I share is the reversal of the linked list and the difficulty coefficient of two stars! No more nonsense, let's start with the topic! 1.1 subject requirements Topic type: linked list inversion Title Content: reverse the link order of the single linked ...

Added by papapax on Sun, 19 Dec 2021 12:29:32 +0200

Learning notes on data structure and algorithm -- circular linked list and bidirectional linked list

Data structure and algorithm learning notes (C language) Circular linked list 1. Definition: circular linked list is another form of linked storage structure. Its feature is that the pointer field of the last node in the table points to the head node, and the whole linked list forms a ring. If the circular linked list is an empty list, the ne ...

Added by hasek522 on Sun, 19 Dec 2021 05:56:20 +0200

Binary tree series

Single valued binary tree If each node of a binary tree has the same value, the binary tree is a single valued binary tree. true is returned only when the given tree is a single valued binary tree; Otherwise, false is returned. Example 1: Input: [1,1,1,1, null, 1] Output: true Example 2: Input: [2,2,2,5,2] Output: false link /** * Definition ...

Added by dpsd on Sun, 19 Dec 2021 05:16:10 +0200

[multi objective optimization solution] particle swarm optimization algorithm for distribution network emergency repair optimization [Matlab 777]

1, Introduction to particle swarm optimization 1 concept of particle swarm optimization Particle swarm optimization (PSO) is an evolutionary computing technology, which originates from the research on the predation behavior of birds. The basic idea of particle swarm optimization algorithm is to find the optimal solution through the cooperation ...

Added by fotobleu on Sun, 19 Dec 2021 04:30:32 +0200

C language input and output examples

Input and output exercises in online programming of C language A+B(1) Time limit: 1 second for C / C + + and 2 seconds for other languages Space limitation: C/C++ 256M, other languages 512M Input Description: the input includes two positive integers a and B (1 < = a, B < = 10 ^ 9), and the input data includes multiple groups. ...

Added by jjk-duffy on Sun, 19 Dec 2021 02:03:05 +0200

String matching algorithm

First agree on two concepts, main string and pattern string For example, if you look up the s string in the s string, s is the main string and S is the mode string Search the "cdf" mode string in the main string as follows: Main string and mode string BF Brute force matching is a very simple string matching algorithm, which mat ...

Added by anthill on Sun, 19 Dec 2021 01:05:28 +0200

Super detailed Java implementation of bubble sort, selection sort and insertion sort [super easy to understand] ❀❀❀

Bubble sorting Step analysis and introduction As can be seen from the figure below, when comparing two adjacent elements, the large number will move backward (how to move it later?), so after each comparison, a larger number will be placed at the end, and the last number does not need to be compared, that is, after each comparison, the ...

Added by fibonacci on Sat, 18 Dec 2021 23:03:06 +0200

Java sorting algorithm [updating]

Sorting algorithm refers to sorting one or more groups of data through a specific algorithm, so that the group of data conforms to ascending or descending order, which is convenient for calculation and screening, and improves the efficiency of data processing. Sorting algorithms can be implemented in a variety of computer languages. Here we imp ...

Added by ankhmor on Sat, 18 Dec 2021 21:55:22 +0200

Java multithreading and concurrent programming | synchronization container & Atomic package & CAS algorithm

preface In the multithreaded environment, many classes we use everyday have thread safety problems, such as ArrayList, HashSet and HashMap. How should we deal with the thread problem in the multithreaded environment? What is the CAS algorithm? Is there any other way to achieve thread safety other than synchronized? Optimistic lock? Pessimis ...

Added by Stray_Bullet on Sat, 18 Dec 2021 19:19:51 +0200

Dynamic programming of C + + algorithm

Simple dynamic programming Explanation: dynamic programming (DP) is effective in finding the optimal solutions of many overlapping subproblems. It recombines the problems into subproblems. In order to avoid solving these subproblems many times, their results are gradually calculated and saved, from the simple problem to the whole problem. Dyna ...

Added by DoomyCheese on Sat, 18 Dec 2021 15:54:42 +0200