Red black tree -- c language implementation code

Red black tree Red black tree is a binary lookup tree with color attribute for each node, either red or black. In addition to the mandatory General requirements for binary search trees, we have added the following additional requirements for any effective red black tree: Nature 1 Nodes are red or black. Nature 2 The root node ...

Posted by jfugate on Fri, 14 Jan 2022 09:35:30 +0100

[Blue Bridge Cup brush questions] day-01

Basic exercise factorial calculation of test questions Problem description Enter a positive integer n and output n! Value of.    Where n= 123*…*n. Algorithm description n! It may be very large, and the range of integers that can be represented by the computer is limited, so it is necessary to use high-precision calculation m ...

Posted by LawsLoop on Fri, 14 Jan 2022 09:26:04 +0100

Random number, time stamp, number guessing game

random number The function generated by random number is rand(), which is in the standard library, so we need to add its header file < stdlib h> Error demonstration!!! #include <stdio.h> #include <stdlib.h> int main() { int ret; ret=rand(); printf("%d\n",ret); return 0; } In this way, the simplest random number is gene ...

Posted by andrewburgess on Fri, 14 Jan 2022 02:04:55 +0100

Shared memory for Linux interprocess communication

Shared memory allows two unrelated processes to access the same logical memory. It is a very effective way to transfer data between two running processes. Most of the specific implementations of shared memory arrange the memory shared by different processes into the same physical memory. Shared memory is a special address range created by I ...

Posted by FidelGonzales on Thu, 13 Jan 2022 12:27:20 +0100

C + + - the essence of reference, the relationship between const and pointer, and the relationship between const and reference

Nature of reference For the following program (including after compilation): void fun(int &a) //--> void fun(int * const a) { int *p = &a; //-->int *p = a;//int *p = *&a; a = 100; //-->*a = 100 *p = 200; } int main() { int x = 10; int &y = x; //-->int * const y = &x; fun(x); //-->fun(&amp ...

Posted by dscapuano on Thu, 13 Jan 2022 10:07:28 +0100

Detailed explanation of the function of extern "C"

The main function of extern "C" is to correctly implement C + + code and call other C language code. After adding extern "C", the compiler will be instructed to compile this part of the code in C language instead of C + +. Since C + + supports function overloading, the compiler will add the parameter type of the function to ...

Posted by Jackdaw on Thu, 13 Jan 2022 04:04:21 +0100

Data structure -- 6 sort

In our study of data structure, sorting is undoubtedly a very important algorithm. It should be described as an algorithm rather than a data structure. There will be many sorting algorithms in sorting. These sorting algorithms have their own advantages and disadvantages. They are designed with the wisdom of predecessors. There are many excellen ...

Posted by dominod on Wed, 12 Jan 2022 08:21:00 +0100

Redis string

character stringThe standard form of string in C language is NULL(0x \ 0 in hexadecimal) as the terminator. If you want to obtain the length of string, you need to use strlen standard library function. The algorithm complexity of this function is O(n), and you need to traverse the whole string. Redis can't afford such a slow speed,Therefore, th ...

Posted by somethingorothe on Tue, 11 Jan 2022 19:31:46 +0100

Software system of takeout platform based on C/S architecture implemented by Qt framework

Takeout platform based on C/S architecture introduction This time, a takeout platform software with C/S architecture is implemented under the Qt framework. The client uses Qt::Widgets and Qt::Network modules, and the server uses Qt::Sql and Qt::Network modules. The application scenario of the system is: one server instance serves multiple cli ...

Posted by xploita on Tue, 11 Jan 2022 14:57:13 +0100

The strongest C language tutorial in history -- character function & string function

catalogue 1. Is there a string in C language? 2. Function introduction 2.1 strlen() 2.1.1 simulation implementation strlen() (implemented by three methods) 2.1.2 precautions 2.1.3 introduction to strlen() function 2.2 strcpy() 2.2.1 Simulation Implementation (strcpy) 2.2.2 precautions 2.3 strcat() 2.3.1 Simulation Implementation (s ...

Posted by just1ncase on Tue, 11 Jan 2022 11:58:41 +0100