06 vector class and Simulation Implementation in STL

1, Introduction to vector 1. vector is a sequence container that represents a variable size array. 2. Like an array, vector also uses continuous space to store elements, which also means that the elements of vector can be accessed by subscripts. 3. The difference between vector and ordinary array is that the size of vector can be chan ...

Posted by andremta on Sat, 06 Nov 2021 15:48:17 -0700

Grasp the detailed process of function call stack from the perspective of instruction

Stack space          Stack space is expanded from high address to low address, and heap address is expanded from low address to high address.          Stack is a data structure with certain rules. We can add and delete data according to certain rules. It uses th ...

Posted by Typer999 on Sat, 06 Nov 2021 14:14:59 -0700

SP6779 GSS7 - Can you answer these queries VII

Title Link: SP6779 GSS7 - Can you answer these queries VII General meaning Given a tree with n n A tree with n nodes, each node has a weight w i ( ...

Posted by Ghost_81st on Sat, 06 Nov 2021 13:27:50 -0700

Week 1 algorithm learning and sorting

Weekly summary of algorithm practice (10.31-11.6) Learning objectives: One week elementary practice of algorithm Learning content: 1. Question: call fee calculation 2. Problem: time conversion 3. Problem: Abbreviated summation 4. Problem: word encryption 5. Problem: monkeys eat peaches Study time: 1. 7 p.m. - 9 p.m. from Monday to ...

Posted by SieRobin on Sat, 06 Nov 2021 13:05:49 -0700

Merge sort algorithm - C++

The main idea of merge sort algorithm is to merge two ordered arrays into an ordered array. Its key point adopts the "divide and conquer idea". The "divide" is a dichotomy, which divides the unordered array into ordered arrays, and then through the "divide and conquer"   Merge two ordered arrays into one orde ...

Posted by matvespa on Sat, 06 Nov 2021 10:08:50 -0700

Effective C + + learning notes (clause 11: handle "self assignment" in operator =)

Recently, I started to watch Effective C + +. In order to facilitate future review, I specially took notes. If I misunderstand the knowledge points in the book, please correct!!! "Self assignment" means to assign values to yourself, such as: class Widget{...}; Widget w; w = w; //Assign yourself a value This looks stupid, but it' ...

Posted by eashton123 on Sat, 06 Nov 2021 08:54:50 -0700

Chapter 3 - subsection 3.3 of learning notes of C + + new classic course (important)

  This blog will record: notes of relevant knowledge points of class! (this has been learned once when learning the basic course of C + +, which is just a brief review here again) This knowledge is divided into the following five points:   1, Implement the member function inline in the class definition   2, const at the end ...

Posted by urgido on Sat, 06 Nov 2021 08:04:11 -0700

C++11 concurrency and multithreading notes async, future, packaged_task,promise

1. std::async and std::future create background tasks and return values 1.1 std::async std::async is a function template used to start an asynchronous task. After starting an asynchronous task, it returns an std::future object. std::future is a class template.Start an asynchronous task: create a thread and start executing the correspondin ...

Posted by DoddsAntS on Sat, 06 Nov 2021 01:54:01 -0700

c language -- detailed explanation of common string functions and sizeof

1.sizeof use a. Code 1 int main() { int a = 0; int arr[] = { 1,2,3,4 }; printf("%d\n", sizeof(a)); printf("%d\n", sizeof a); printf("%d\n", sizeof(&a));//Indicates the size of the address printf("%d\n", sizeof(int)); printf("%d\n", sizeof(arr));//Calculates the size of the array arr in bytes printf("%d\n", sizeof(arr)/sizeof(arr[0 ...

Posted by daveyc on Fri, 05 Nov 2021 15:33:05 -0700

Dynamic memory management (heap)

catalogue Why is there dynamic memory management How to manage space? Introduction to dynamic memory functions malloc and free calloc ​ realloc Common dynamic memory errors Written test questions Flexible array   Use of flexible arrays Advantages of flexible arrays Why is there dynamic memory management 1. You can a ...

Posted by seaten on Fri, 05 Nov 2021 13:30:55 -0700