## 235. The nearest common ancestor of a binary search tree 701. Insertion operations in a binary search tree 450. Deleting nodes in a binary search tree

235. The most recent common ancestor of the binary search tree Likou question link(opens new window) Given a binary search tree, find the nearest common ancestor of two specified nodes in the tree. class Solution { private: TreeNode* traversal(TreeNode* cur, TreeNode* p, TreeNode* q) { if (cur == NULL) return cur; // middle if (cur->val […]

## [Data structure] Sorting insertion sort and selection sort

Blog homepage: Xiao Wang is sleepy again Column Series: Data Structure People are learning, if they don’t get closer, they will retreat Thank you everyone for liking, collecting, and commenting Table of Contents 1. The concept of sorting and its classification 1.1 Concept of sorting 1.2 Sorting classification 2. Insertion sort 2.1 Direct insertion sort […]

## Data structure – various sorting algorithms (insertion, exchange, selection, merge)

1. Declaration and definition of functions sort.h #pragma once #include <stdio.h> #include <stdlib.h> #define MaxSize 5 typedef int KeyType; typedef char InfoType; typedef struct { KeyType key; //The key here is the value we want to sort InfoType data; }RecType; #ifndef __SORT_H__ #define __SORT_H__ //Insert directly void InsertSort(RecType R[], int n); //Half insertion sort (dichotomy […]

## JDBC implements database batch insertion

Table of Contents 1. Several ways to implement batch insertion using JDBC 2. Use of PreparedStatement addBatch method 3. The difference between Statement and PreparedStatement Using Java Database Connectivity (JDBC) to implement batch insertion can improve the efficiency of database operations, especially when multiple pieces of data need to be inserted at one time. 1. […]

As a derivative of C language, C++ makes up for many deficiencies in C language and also makes certain optimizations to C language! Today, let’s explain the knowledge related to input/output in C++! And overloading of input/output! , I hope that after reading this article, readers will have a deeper understanding of input/output streams in […]

## Rust Algorithm Ranking – Illustration and Code Implementation of Insertion Sort

The writing process of Rust code is slightly different from that of other languages, because its compiler does not allow any unsafe writing methods, so the longest time spent in the code writing process is finding compilation errors. s reason. This also has advantages – after the code is written, the stability is greatly improved! […]

## Sorting insertion sort and selection sort

In our daily life, sorting is widely used. A useful sorting algorithm can greatly improve the speed. Today we will learn four of the eight major sortings: direct insertion sorting, Hill sorting, selection sorting, Heap sort. Table of Contents 1. Direct insertion sort 2. Hill sorting 3. Select sorting 4. Heap sort 1. Direct insertion […]

## [C++] Implementation of red-black tree insertion operation and verification of whether the red-black tree is correct

Blog homepage: Home Series of columns: C + + Thank you everyone for likingCollecting?Comments Looking forward to making progress with everyone! Article directory Preface 1. Insertion operation of red-black tree 1. Definition of red-black tree nodes 2. Insertion of red-black tree 1.uncle exists and is red 2.uncle does not exist 3.uncle exists and is black […]