List 6 methods to remove weight, this method is the most perfect

In daily business development, there are occasional scenarios in which the duplicate data in the List collection needs to be removed. At this time, some students may ask: why not use Set or LinkedHashSet directly? So there is no problem of duplicate data? ​ I have to say that the students who can ask this question are very clever and see the e ...

Added by conman90 on Thu, 09 Dec 2021 03:01:28 +0200

Overview and application of recursion

recursion In short, recursion is a method that calls itself and passes in different variables each time. Recursion helps programmers solve complex problems and makes code concise. Recursive call mechanism 1) Printing problem 2) factorial problem public class RecursionTest { public static void main(String[] args) { //print(4) ...

Added by msurabbott on Wed, 08 Dec 2021 23:45:16 +0200

Data structure experiment 8 (balanced binary tree + Hash)

Answer the corresponding questions written by the LORD before, click View here . I personally feel that the previous value is relatively high, and the search for names is much more important than the search for numbers. However, the balanced binary tree is mainly used here, which is a supplement to the previous one. It should be noted here. I ...

Added by Keaner on Wed, 08 Dec 2021 23:40:00 +0200

PAT a title translation + answer AcWing (Mathematics)

1081 Rational Sum (20 points) Rational numbers; numerator/denominator; integer part; fractional partGive n scores, sum, write true scores and approximate scoresIdea: initialize a as 0 and B as 1; Output: if the denominator is 1, you can directly output the integer part; If a > b, there are integer and decimal parts; The data range of numera ...

Added by kiosklim on Tue, 07 Dec 2021 23:20:11 +0200

Algorithm notes - classic template

BFS templatevoid BFS(int s){ queue<int> q; q.push(s); while(!q.empty()){ Take out the team head element front; Access team leader element front; Take the first element out of the team; take front All nodes that have not been queued in the next layer of nodes are queued, and the queued nodes are ...

Added by micmac on Tue, 07 Dec 2021 16:47:56 +0200

Red black tree (C + + implementation)

Concept of red black tree Red black tree is a binary search tree, but a storage bit is added on each node to represent the color of the node. This color can be red or black, so we call it red black tree. By limiting the coloring mode of each node on any path from root to leaf, the red black tree ensures that no path will be twice as ...

Added by chris davies on Mon, 06 Dec 2021 21:30:53 +0200

Basic principle and implementation of common sorting algorithms (fast sorting, merging, heap sorting, direct insertion...)

@TOC Overview of common sorting algorithms 1. Concept 1.1 sorting Sorting is the operation of increasing or decreasing the sequence to be sorted according to the size of one or some keywords (what is used as the benchmark). If sorting is mentioned at ordinary times, it usually refers to ascending (non descending) order. Sorting in the gen ...

Added by scoobydoo9749 on Mon, 06 Dec 2021 04:26:13 +0200

Data structure ~ basic 2 ~ tree [design of binary tree, binary search tree, AVL tree, B tree and red black tree] ~ red black tree

Data structure ~ basic 2 ~ tree [design of binary tree, binary search tree, AVL tree, B tree and red black tree] ~ red black treehttps://www.cnblogs.com/shan333/p/15496806.html I   Red black tree: ☼   Introduction to red black tree: -----------Morphologically, it is a special binary search tree [specially reflected in color, an ...

Added by tallberg on Mon, 06 Dec 2021 01:53:48 +0200

PAT Topic A Translation + Answer AcWing

1010 Radix (25 points) Topic: radix digitsTopic: Give the base of two numbers and one of them, ask if the other number can be equal to this number in a certain base.Ideas: If tag equals 2, swap, and finally just need to deal with tag 1, this idea is worth learning; The first step is to convert n1 to decimal, and consider if this can be saved. ...

Added by vozzek on Mon, 06 Dec 2021 00:44:36 +0200

Detailed explanation of Java linked list -- easy to understand (super detailed, including source code)

catalogue concept Classification of linked lists Structure of linked list Code implementation linked list 1. Create node class 2. Create linked list Method 1: enumeration method Method 2: head interpolation public void addFirst(int data) Method 3: tail interpolation public void addLast(int data) 3. Print linked list: public void displ ...

Added by syd on Mon, 06 Dec 2021 00:31:07 +0200