C + + class constructors, destructors, copy constructors, and problems with implicitly instantiating objects
C + + constructors and destructors are used for object initialization and cleaning. When each class is defined, three functions will be created by default - constructors, destructors and copy constructors
1. Default constructor
Constructors are similar to python's__ init__ Method, which is called automatically and only once when the class is in ...
Posted by 7pm on Mon, 08 Nov 2021 14:45:34 -0800
Analysis of leetcode problem solving ideas 839 - 845 questions
Similar string Give you a list of strings strs. Each string in the list is an alphabetic word for all other strings in strs. How many similar string groups are there in strs?
Using the idea of joint search set, the string array is transformed into a graph to find the connected edge
class Solution {
public:
vector<int> f;
int fi ...
Posted by sonicfusion on Mon, 08 Nov 2021 13:02:00 -0800
c + + factory mode
Before you get familiar with factory mode, you should first understand the six guidelines before writing c + + programs
Opening and closing principle: do not modify existing codes, only add codes.Dependency Inversion Principle: use abstract classes instead of concrete classes to solve problems. (isolation change, package change)Richter substit ...
Posted by dessolator on Mon, 08 Nov 2021 08:15:28 -0800
C + + Learning Day10 -- references, classes
Day1
Reference
What is a reference
A reference is a pointer. A reference is just a high-level modification based on correction to make the code easier to read. A reference is a reference to an existing variable. In other words, "reference variable" must refer to an existing variable. It is not a new variable itself. They do not rea ...
Posted by mandred on Mon, 08 Nov 2021 07:20:27 -0800
Linux multithreaded server programming notes-1
Thread safe object creation, callback and Deconstruction in C + +It is not difficult to write thread safe classes. You can use synchronization primitives to protect the internal stateMost STL classes are not thread safe and need to be locked externally to ensure simultaneous access by multiple threadsSecure object creationThe only requirement i ...
Posted by Rottingham on Mon, 08 Nov 2021 01:24:48 -0800
Recursion and recursion
Recursion and recursion (2)
1.Simple Fibonacci
The following sequence 0 1 1 2 3 5 8 13 21... Is called Fibonacci sequence.
This sequence starts with Item 3, and each item is equal to the sum of the first two items.
Enter an integer N, please output the first N items of this sequence.
Input format An integer N.
Output format Output the fir ...
Posted by Ristiisa on Sun, 07 Nov 2021 22:31:43 -0800
ICPC Macao 20I - tree chain subdivision optimization, space complexity, good problem
Portal 1 perhaps Portal 2
Note that the space limit is 8MB!
This question is too comprehensive. If you can write it independently, it means that you can get gold at Macao station. In addition, the space complexity of tree chain subdivision optimization is really the first time I heard~
Firstly, it examines a conclusion of game theory: in the ...
Posted by YorkshireSteve on Sun, 07 Nov 2021 17:15:02 -0800
C + + learning notes -- differences from C, constants, references, function overloading, default formal parameters and classes
Note: the coding tool is CLion+Cygwin64
catalogue
Difference from C
constant
C language
C++
Reference and constant reference
Exchange two variable values by reference
const reference
function overloading
C language
C++
Default parameter
Special writing method of invisible parameter variable name
Preliminary study on class
Boolea ...
Posted by healthbasics on Sun, 07 Nov 2021 10:39:54 -0800
Weekend Summary 4 (Basic Common Knowledge)
This week is also not much, no week I am satisfied with, no sense of knowledge to enrich, feel pushed by the task, plan the weekend two days to brush topics and organize evening homework, but really not as good as to do it in advance. On Sunday, I temporarily added two thought reports, a love letter, and I was very speechless. I hope I can ...
Posted by lunarul on Sun, 07 Nov 2021 08:27:37 -0800
Summary of basic algorithms
Bit operation
Pilot brother
Title Link
Problem solving ideas:
Each switch of the chessboard has two states: on or off, so the total number of States is
2
16
2^{16}
216. The range of int is not ...
Posted by thallium6 on Sat, 06 Nov 2021 18:01:47 -0700