Data structure and algorithm: the basic part of tree structure
Basic part of tree structure
1, Binary tree
1. Why do you need a tree data structure
1.1 analysis of array storage mode
Advantages: it is fast to access elements by subscript. For ordered arrays, binary search can also be used to improve the retrieval speed. Disadvantages: if a specific value is to be retrieved, or the inserted value (in a ...
Added by ealderton on Wed, 19 Jan 2022 14:01:14 +0200
Codeforces 1547f array stabilization (GCD version)
Title Link: Array Stabilization (GCD version)
General meaning
Given an array of length n, the subscripts are from 1 to n. where an and a1 are connected (form a ring)
Each round of operation yields a new array b: for all I ∈ [1, n], b[i] = gcd(a[i], a[i + 1]) (b[n] = gcd(a[n], a[1]) Finally, copy the new array b to the original array a
...
Added by john-iom on Wed, 19 Jan 2022 11:52:20 +0200
Heap + graph brief overview
heap
Priority queue
A special "queue" in which elements are taken out according to the priority (keyword) size of elements rather than the order in which elements enter the queue. Implementation method: (1) Arrays: inserting (elements are always inserted at the end) Delete (find the largest or smallest keyword and delete the ele ...
Added by jdavidbakr on Wed, 19 Jan 2022 05:25:57 +0200
Compare the number of methods that output all prime numbers within 1 million, 10 million and 100 million with the optimized running time
There are four code snippets
The first is the most basic method. Because the efficiency of the method is too poor, it is tested with 10W first. The final optimized program will run all prime numbers within 100W. Because the program has different thinking and computing power, there will be an episode in the middle, which will be explained in th ...
Added by jimdidr on Wed, 19 Jan 2022 00:46:44 +0200
Get to know JVM (take you to know JVM from different perspectives)
summary
When it comes to the three letters of JVM, what first pops out of your mind? I generally analyze the following three kinds of people:
The first one: I know the three letters of JVM separately. I don't know what it isSecond: isn't it a Java virtual machine that runs Java programsThe third kind: it is divided into heap memory, method ...
Added by TNIDBMNG on Wed, 19 Jan 2022 00:10:02 +0200
Analyze and understand jdk1 put() method of HashMap, version 8 Java collection
HashMap is the most commonly used key value collection in java. It is necessary to understand its principle and underlying code. Today, record the of HashMap Research and analysis of put() method (element addition method);
First, let's talk about the results of personal research and analysis:
During instance initialization, HashMap does ...
Added by a1amattyj on Wed, 19 Jan 2022 00:01:02 +0200
Summary of common sorting algorithms
Bubble sorting
Bubble sorting is a process of comparison There are two layers of loops. The outer layer actually controls the number of times. Each cycle will have a maximum value exchanged to the tail Then you don't need to bring it on the next cycle Each inner layer cycle will be compared from the beginning to the end Only the latter of t ...
Added by timgolding on Tue, 18 Jan 2022 20:18:43 +0200
Array structure of data structure and algorithm
Data structure and algorithm (1) array structure
I Basic use of arrays
Create and initialize arrays
It is easy to declare, create, and initialize arrays in JavaScript, as follows: //Create and initialize arrays
let daysOfWeek = new Array();
let daysOfWeek = new Array(7);
let daysOfWeek = new Array('Sunday','Moday','Tuesday','Wednesday','Thu ...
Added by stvs on Tue, 18 Jan 2022 15:43:15 +0200
How does SpringBoot use prefix trees to filter sensitive words
1, Prefix tree
Generally, when designing websites, there will be problem publishing or content publishing functions. A very important point of these functions is how to realize sensitive word filtering. Otherwise, there may be bad information publishing, or the published content may contain code fragments with malicious functions. The basic al ...
Added by j0n on Tue, 18 Jan 2022 10:08:00 +0200
[java data structure and algorithm linked list]
I Linked list
1. Linked list definition
A linked list is a recursive data structure. It is either empty (null) or a reference to a node that contains a generic element and a reference to another linked list. In this definition, a node is an abstract entity that may contain any type of data type. Its applications to nodes show its usefulne ...
Added by gvanaco on Tue, 18 Jan 2022 09:53:57 +0200