Leetcode[300. Implement Trie] - prefix tree

Leetcode[300. Implement Trie] - prefix tree Title: Trie (pronounced like "try") or prefix tree is a tree data structure used to efficiently store and retrieve keys in string data sets. This data structure has many application scenarios, such as automatic completion and spell checking. Please implement the Trie class: Trie() Initia ...

Added by ignite on Mon, 07 Mar 2022 22:13:56 +0200

c language memory distribution and pointer assignment error (RO area error)

catalogue Memory distribution in C Memory space is divided into heap, stack and program area Stacking area:    that is, dynamic memory allocation. Programmers can apply for any size of space through malloc, but remember to release free after using this space, so as not to cause memory leakage. Stack area:    the st ...

Added by cyberRobot on Fri, 04 Mar 2022 02:45:42 +0200

Comprehensive analysis of C array

Comprehensive analysis of C array Array name The value of the array name is a pointer constant, that is, the address of the first element of the array Its type depends on the type of array element There are only two situations where array names are not represented by pointer constants------- ① sizeof (array name), calculate the size of the ...

Added by Kardall on Thu, 24 Feb 2022 12:48:48 +0200

share_ptr memory leak

Here is shared_ There are three common ways to define PTR: shared_ptr sp;// Declare a smart pointer to type int sp.reset(new int(42)); auto sp1 = make_shared<string>("hello");//sp1 is a smart pointer shared_ptr sp2(new int(42)); And make_ The shared method is a recommended one. It uses one-time allocation and is relatively safe. We all ...

Added by aquila125 on Sun, 20 Feb 2022 05:31:38 +0200

Data structure: wonderful journey of stack and queue (picture and text show you the charm of stack and queue)

Stack Definition: a stack is a linear table whose insertion and deletion operations are limited to one end of the table. It is usually called the top of the stack and the bottom of the stack. When there are no elements in the table, it is called empty stack. Example: suppose stack S=(a1, a2, a3,... an), then a1 is called the bottom element ...

Added by micbox on Fri, 18 Feb 2022 13:17:53 +0200

Polymorphism of three characteristics of C + + object-oriented program

Concept of polymorphism Different types of objects respond differently to the same message, which is called polymorphism. Generally speaking, it is to complete a certain behavior. When different objects complete it, they will produce different results For example, if you go to an Internet cafe to get online, if you are a vip, the pri ...

Added by joePHP on Fri, 18 Feb 2022 13:15:57 +0200

Explain const reference, constant pointer and pointer to constant in detail

Once the const object is created, its value cannot be changed, so the const variable must be initialized.As long as the value of const is not changed, const variable is the same as other variables const object in multiple files: By default, objects decorated with const are only valid in files. This means that allowing const variables with the ...

Added by Bourgeois on Fri, 18 Feb 2022 04:10:03 +0200

C + + concurrency and multithreading

1. Pass temporary object as thread parameter 1.1 pitfalls to avoid (explanation 1) First analyze the parameter i. The analysis shows that for i, the function in the thread originally uses reference transfer, but actually uses value transfer. Therefore, even if detach is used in the main thread to end the main thread first, the sub thread ...

Added by thinguy on Fri, 18 Feb 2022 02:21:01 +0200

C + + foundation -- const qualifier

C + + foundation -- const qualifier 1. const qualifier Const qualifier means that the modification type is constant, that is, the variable modified with const qualifier is an immutable quantity, which can act on many types, such as basic type, structure type, pointer, etc const modifies the basic variable type const modifies the bas ...

Added by yozyk on Thu, 10 Feb 2022 15:07:15 +0200

C + + "STL vector Learning Notes"

Introduction: The vector class is called the vector class. It implements a dynamic array, which is used for an array of objects with variable number of elements. The elements in the order container are sorted in strict linear order. The corresponding element can be accessed through the position of the element in the sequence. When expanding ...

Added by bluntster on Wed, 09 Feb 2022 01:16:10 +0200