L2-002 linked list weight removal (25 points)
L2-002 linked list weight removal (25 points)
Given a linked list L with integer key values, you need to delete the key value nodes with duplicate absolute values. That is, for each key value K, only the node with the first absolute value equal to K is retained. At the same time, all deleted nodes must be saved in another linked list. For exam ...
Posted by deadonarrival on Fri, 04 Feb 2022 15:16:59 +0100
C++ 11 smart pointer
Function of smart pointer
Using heap memory in C + + programming is a very frequent operation. The application and release of heap memory are managed by programmers themselves. Programmers can improve the efficiency of the program by managing the heap memory themselves, but on the whole, the management of heap memory is troublesome. The concep ...
Posted by andysez on Fri, 04 Feb 2022 14:25:46 +0100
unordered_map usage details
STL: unordered_map usage notes
Reference website:
cpluscplusunordered_ Difference between map and map (CSDN)
1. General
unordered_ The template of map is defined as follows:
template < class Key, // unordered_map::key_type
class T, // unordered_map::mappe ...
Posted by zephyrstudios on Fri, 04 Feb 2022 13:31:46 +0100
Declaration and function of class 2 | in C + +
2, Class declaration and function
In my opinion, a class relative to a structure is just like a structure relative to an array. The operability range and depth of the realization of logical functions are higher. In C + +, the use of classes is a bit like the structure. Now we will introduce C + + classes with the structure.
Example 7-1: a ...
Posted by bdlang on Fri, 04 Feb 2022 10:42:54 +0100
[C + +] binary search tree
Today we will talk about a special binary tree, binary search tree. Learning binary search tree well will help us understand and master map and set later.
Binary search tree concept
Binary search tree, also known as binary sort tree, is either an empty tree or a binary tree with the following properties:
If its left subtree is not empty, ...
Posted by bigshwa05 on Fri, 04 Feb 2022 08:31:05 +0100
[C + +] memory management
[objectives of this section] 1. C/C + + memory distribution 2. Dynamic memory management in C language 3. Dynamic memory management in C + + 4. operator new and operator delete functions 5. Implementation principle of new and delete 6. Positioning new expression 7. Common interview questions
1. C/C + + memory distribution
Let's first look at ...
Posted by mcubedma on Fri, 04 Feb 2022 07:12:29 +0100
C + + Advanced -- program memory model - four memory areas
catalogue
c + + core programming
Memory partition model
1. Before program operation
2 after the program runs
3 new operator
c + + core programming
This stage mainly focuses on the detailed explanation of C + + object-oriented programming technology, and discusses the core and essence of C + +.
Memory partition model
When the C + + p ...
Posted by solarisuser on Fri, 04 Feb 2022 05:00:30 +0100
C++STL function object, predicate, built-in function object
Function object
Concept:
A class that overloads the function call operator. Its object is often called a function objectWhen a function object uses overloaded (), its behavior is similar to that of a function call, so it is also called an imitation function
Essence:
An object is a function, not a function
Function object usage
charact ...
Posted by subcool on Fri, 04 Feb 2022 04:21:56 +0100
Day12-Recursive+Tree
Title Source: LeetCode
LeetCode Month Emblem Title of the Day
1414. and the minimum number of Fibonacci numbers for K
Give you the number k, and return the smallest number of Fibonacci numbers for k, where each Fibonacci number can be used multiple times.
The Fibonacci number is defined as:
F1 = 1 F2 = 1 Fn = Fn-1 + Fn-2, where n > 2. T ...
Posted by jcarver on Thu, 03 Feb 2022 21:04:43 +0100
Sword finger Offer 67 Convert string to integer
Title Description:
Write a function StrToInt to realize the function of converting string into integer. atoi or other similar library functions cannot be used.
First, the function discards useless opening space characters as needed until the first non space character is found.
When the first non empty character we find is a positive ...
Posted by supermars on Thu, 03 Feb 2022 20:23:54 +0100