Heap sorting: Use binary trees to implement, build a large heap, and select the largest data (root node) each time Time complexity is O(nlogn), unstable Quick queue: Each sorting can determine the position of an element. The general time complexity is O(nlogn) and is unstable One-time sorting: Select a base element, find the small one […]
Tag: insertion
Single linked list creation, insertion, deletion, search and output
//Create, insert, delete, search, output //Inserting into a singly linked list is not appropriate considering the bit order. //Singly linked list deletion considers whether the bit order is inappropriate and whether the linked list is empty. Deletion must be done by two pointers in tandem. //Singly linked list search considers whether the bit order is […]
Data structure—–Insertion of red-black tree
Table of Contents Preface Red-black tree storage structure 1. Node rotation operation Left Rotation Right Rotation 2. Insert node 1. An empty tree is inserted 2. Insert the key of the node and repeat it again 3. The parent node of the inserted node is black 4. The parent node of the inserted node is […]
<Sort Algorithm 1>Quickly understand “direct insertion sort” and “Hill sort”
1. Direct insertion sorting 1.1 Import Imagine that when you come home during the Chinese New Year, there are a lot of relatives and friends sitting around. At this time, you have to have a few playing cards to entertain you. Confused, you were dragged into the game, and soon, a pile of playing cards […]
[Regaining C Language] 13. Dynamic data organization (2) Linked list (creation, traversal retrieval, insertion, deletion, exchange)
Table of Contents Preface 13. Dynamic data organization 13.1~2 Dynamic data organization, dynamic variables 13.3 Linked list 13.3.1 One-way linked list-creation 13.3.2 One-way linked list-traversal retrieval 13.3.3 One-way linked list-insertion, deletion and exchange insert delete exchange 13.3.4 One-way linked list-example 13.3.5 Stacks and Queues Foreword A linked list is a common dynamic data structure that […]
Clickhouse large data insertion in Java project
Clickhouse large data insertion in Java project Article directory Clickhouse large data insertion in Java project background Code Import dependencies Define Clickhouse configuration information Encapsulating Clickhouse client Implement Clickhouse batch insertion Summarize Background Recently, because the Clickhouse database was used in the project, based on the thinking of the MySQL database, the Java + MP […]
[C/C++ Data Structure – 2]: Stability and optimization revealed, unveil the mystery of insertion sort, Hill sort and quick sort!
Article directory sorting stability insertion sort Optimization of insertion sort Hill sort Quick sort Stability of sorting Stable sorting: The order of two equal numbers in the sequence before sorting is the same as the order of their two equal numbers after sorting. (For example: bubble, insert, cardinality, merge) Unstable sorting: The relative positions of […]
C. Optimal Insertion
Table of Contents 1.Problem 2.Input 3.Output 4.Examples 4.1input 4.2output 5.Code 6.Conclusion 1.Problem You are given two arrays of integers a1,a2,…,ana1,a2,…,an and b1,b2,…,bmb1,b2,…,bm. You need to insert all elements of bb into aa in an arbitrary way. As a result you will get an array c1,c2,…,cn + mc1,c2,…,cn + m of size n + mn + […]
[Data structure] Red-black tree insertion self-balancing implementation
Foreword I am so busy with my studies in the new semester that I have no time to update my blog. Today I compiled the relevant knowledge about red-black trees. The codes are all handwritten simplified versions. If there are any problems, I would like to criticize and correct them Red Black Tree Introduction Red […]
Mybatis real batch insertion-overriding method InsertBatchSomeColumn
1. Add custom method SQL injector //Add method for batch insertion public class CustomSqlInjector extends DefaultSqlInjector { @Override public List<AbstractMethod> getMethodList(Class<?> mapperClass) { // Get the parent class SQL injection method list List<AbstractMethod> methodList = super.getMethodList(mapperClass); //Add the batch insertion method. This method will be rewritten below. methodList.add(new CustomSqlInjector ()); return methodList; } } 2. […]