Vector C + + language implementation of basic data structure and algorithm
0 - General
The code is based on data structure C + + language version by Mr. Deng Junhui, with appropriate changes. It feels like this is basically a simplified STL. Follow the book and review the basics of C + + language.
1 - interface declaration
The vector class is implemented here. In order to distinguish it from the vector in the stand ...
Added by glcarlstrom on Wed, 26 Jan 2022 11:27:49 +0200
Dichotomy -- P1024 [NOIP2001 improvement group] solution of univariate cubic equation
Question surface:
Tangible, such as a x^3 + b x^2 + c x + d = 0. The coefficients of each item in the equation (a, B, C and D are real numbers) are given, and it is agreed that the equation has three different real roots (the range of roots is - 100 to 100), and the absolute value of the difference between roots is ≥ 1. It is required to ou ...
Added by Asinox on Wed, 26 Jan 2022 10:14:02 +0200
C + + | code reuse | private inheritance
Private inheritance is another way to implement has-a relationship in C + +. With private inheritance, both public and protected members of the base class will be called private members of the derived class. In other words, the base class method will not become part of the public interface of the derived object, but can only be used in the memb ...
Added by stallingjohn on Wed, 26 Jan 2022 07:39:21 +0200
Some common features of C++11 (stability and compatibility)
Some common features of C++11 (stability and compatibility)
1, Original literal
The literal quantity defining the original string is added in C++11. The definition method is: R "xxx (original string) xxx", in which the strings on both sides of () can be omitted. The original literal R can directly represent the actual meaning of the ...
Added by abhikerl on Wed, 26 Jan 2022 05:27:44 +0200
Comprehensive and logical explanation of the organization form in ROS: launch file + meta function package (example + code + parameter analysis)
Introduction to ROS workspace
Meta function Pack: organizer of function pack
For the file structure in ROS, we focus on src. After understanding the file structure of ROS, we know that the src directory can contain multiple function packages. Suppose we need to use the robot navigation module, but this module includes map, positioning, path ...
Added by edtlov on Wed, 26 Jan 2022 01:59:32 +0200
Atcoder beginer contest 236 ABC code style format #ifdef#else#endif ios::sync_with_stdio tie XOR map container vector container
Eight minutes a, the first two, and then the third, the head card fell off. (record the tragic experience. Just keep grinding the problem.
I found this when thinking about the solution:
#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
Learn the form:
#ifdef identifier
Segment 1
#else
Segment 2
#endif
It means: w ...
Added by elie on Tue, 25 Jan 2022 22:07:13 +0200
[C + +] three features: encapsulation, inheritance and polymorphism
Access rights
C + + controls the access rights of member variables and member functions through three keywords: public, protected and private. They represent public, protected and private respectively, which are called member access qualifiers.
Inside the class (inside the code defining the class), no matter whether the members are declar ...
Added by mrmachoman on Tue, 25 Jan 2022 21:52:30 +0200
0019 - delete the penultimate node of the linked list
Problem description
Give you a linked list, delete the penultimate node of the linked list, and return the head node of the linked list. Advanced: can you try using one scan?
Example 1: Input: head = [1,2,3,4,5], n = 2 Output: [1,2,3,5] Example 2: Input: head = [1], n = 1 Output: [] Example 3: Input: head = [1,2], n = 1 Output: [1] ...
Added by Namadoor on Tue, 25 Jan 2022 21:03:40 +0200
10000 word summary of C + + classes and objects [source code analysis of date class]
Classes and objects
Classes and objects < upper >
object-oriented
It has always been process oriented programming, such as C language. Until the 1970s, process oriented programming showed deficiencies in developing large programs. The computer community put forward object-oriented programming, in which the core concepts are class and o ...
Added by JAM on Tue, 25 Jan 2022 20:08:52 +0200
Three design ideas of std::vector concurrency security
Concurrent reading and writing of vectorAs we all know, vector in C + + standard library does not guarantee thread safety. When we read and write vectors concurrently, we often face two risks:Content reading exception: for example, two threads are reading, one is writing, or two threads are writing at the same time, which will lead to inconsist ...
Added by klycette on Tue, 25 Jan 2022 19:31:03 +0200