Implementation of map and set -- red black tree
1. 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, which can be red or Black. 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 longer than other paths, so it is close t ...
Posted by mattsutton on Mon, 31 Jan 2022 16:57:45 +0100
Brother Jiang takes you to play with C language | 17 - file operation
Basic concepts of documents
File stream:
c language regards a file as a sequence of characters, that is, a file is a character stream composed of one character. Therefore, c language also calls a file a file stream. Document classification
text file
It is stored in ASCII format, and one character is stored in one byte. Each byte of ...
Posted by gentusmaximus on Mon, 31 Jan 2022 14:12:06 +0100
C + + class and object polymorphism object-oriented programming
https://www.bilibili.com/video/BV1et411b73Z?p=135https://www.bilibili.com/video/BV1et411b73Z?p=135 Polymorphism is one of the three characteristics of C + + object-oriented
Polymorphisms fall into two categories:
Static polymorphism: function overloading and operator overloading belong to static polymorphism and reuse function names
Dynamic ...
Posted by birdie on Mon, 31 Jan 2022 11:43:30 +0100
Thread synchronization mode - semaphore
1 semaphore
Semaphore, sometimes called semaphore, is a facility used in multi-threaded environment. It can be used to ensure that two or more key code segments are not called concurrently.
Before entering a key code segment, the thread must obtain a semaphore; Once the critical code segment is complete, the thread must release the semaphore. ...
Posted by divinequran on Mon, 31 Jan 2022 11:14:32 +0100
map/set of data structure and algorithm
map/set of data structure and algorithm
map and set are a kind of STL Association container. Generally, when used to quickly find out whether an element exists or repeats, they can be solved through the so-called hash set and hash mapping. In addition to being familiar with their underlying principles, they should also be able to use each cont ...
Posted by ucffool on Mon, 31 Jan 2022 07:41:58 +0100
Operator overloading in C + +
In C + +, we can make operators work for user-defined classes. This means that C + + can provide operators with special meaning for data types, which is called operator overloading. For example, we can overload the operator "+" in a class like String, so that we can connect two strings by using +. Other example classes that may overlo ...
Posted by ryansmith44 on Mon, 31 Jan 2022 05:56:34 +0100
Novice entry programming needs to master several violent algorithms c/c + + and convenient data structures
I will put some main knowledge points that need to be used next to the introduction of the algorithm, and I introduce an algorithm by solving a problem rather than directly;
First: find the most value in an array
Challenge arena method:
const int inf=10e9;
int main(){
int n; scanf("%d",&n);
int min=inf,max=-inf;//Set the ma ...
Posted by Waldir on Mon, 31 Jan 2022 05:28:59 +0100
Detailed explanation of C++STL -- sring class
Detailed explanation of C++STL (I) -- sring class
Content outline of this meeting:
1, How string is defined
The string class implements the overloading of multiple constructors. The commonly used constructors are as follows:
string(); //Construct an empty string
string(const char* s); //Copy the character sequence indicated by s
st ...
Posted by animuson on Mon, 31 Jan 2022 00:36:47 +0100
LeetCode132. Segmented palindrome string II - string dynamic programming
Topic overview
Title Link: Ask me to do the problem
Problem solution
1, General dynamic programming
in that sentence, the dynamic programming of string class can consider the state of the response problem of the first i characters, such as this problem and definition
f
...
Posted by fred_belanger on Sun, 30 Jan 2022 23:46:04 +0100
Data structure | basic operation of binary tree
Previous article: Data structure | tree and binary tree
Liu Dayou, textbook structure
Programming language: C++
catalogue
(1) Storage structure of binary tree
(2) Traversal of binary tree
1. First root traversal
Root first traversal recursive algorithm
Root first traversal non recursive algorithm
2. Middle root traversal
...
Posted by fearfx on Sun, 30 Jan 2022 20:27:22 +0100