Memory leak detection scheme and code implementation

1. Core and causes of memory leakage Memory leak(C/C++) Functions involved: 1 malloc/calloc/relloc new 2 free delete Its core is whether there is distribution or not Memory allocation and release did not match 2 hazards of memory leakage The space above the heap is constantly eroded by the user space. When malloc applies ...

Posted by Dongowarrior on Sun, 24 Apr 2022 08:15:19 +0300

C language programming (fifth edition of Tan Haoqiang) Chapter 10 input and output exercise answers to documents

You can also go to the program coffee( https://meta.chengxuka.com ), open the screen question section of the University. You can not only have answers and explanations, but also answer questions online. Title 1: what is a file pointer? What are the benefits of accessing files through file pointers? Answer: In the buffered FILE system, the key ...

Posted by konn on Sun, 24 Apr 2022 04:43:17 +0300

[sort] eight common sorts

1. Insert sort 2. Hill sort 3. Select Sorting 4. Heap sorting 5. Bubble sorting 6. Quick sort 7. Merge and sort 8. Counting and sorting --------------- Insert sort This sort was originally very simple, as shown in the figure: Let's first insert 9 as an ordered array. It's larger than 8, so swap positions Β  At this time, there i ...

Posted by CountryGirl on Sat, 23 Apr 2022 11:46:10 +0300

Simulation implementation list

The previous blog introduced various function interfaces and uses of list. This blog implements a simple list here to further deepen the understanding of list. frame Unlike the previous vector, list uses a two-way lead link for data storage, so you need to define a structure to store nodes first. template<class T> struct ListNode ...

Posted by kanikilu on Sat, 23 Apr 2022 10:24:26 +0300

Thread foundation of Linux C/C + +

catalogue 1. What is a thread 1.1 process and thread 1.2 threads 1.3 development history of threads 2. How to create and use threads 2.1 pthread_ The create function creates a thread 2.2Β pthread_ Use of the create function 2.3} when the main thread ends, the branch thread will also end 2.4) multiple threads in the same process sha ...

Posted by denzlite on Sat, 23 Apr 2022 09:44:56 +0300

Function recursion (and examples)

catalogue 🀞1. What is function recursion 🀞1) Recursive definition 🀞2) Recursion is the main way of thinking (making big things small) 🀞3) Advantages of recursion πŸ’•2. Two necessary conditions of recursion πŸ’•1) πŸ’•2) ❀️3. Introduction to exercises ❀️1) Print each bit of an integer (recursive implementation) ❀️2) factorization of n (recursi ...

Posted by agadgil on Sat, 23 Apr 2022 07:30:52 +0300

Algorithm: Dynamic Programming -- longest common subsequence

1, Dynamic programming concept The dynamic programming algorithm is similar to the divide and conquer method. Its basic idea is to decompose the problem to be solved into several sub problems. First solve the sub problems, and then get the solution of the original problem from the solutions of these sub problems. Different from the divide ...

Posted by rane500 on Sat, 23 Apr 2022 05:56:27 +0300

Sorting algorithm: fast sorting and merging

Sort Template Quick Sort and Merge Sort of Primary Records Quick sorting mainly deals with the left and right ends before recursion Merge sort is recursive first, on both the left and right ends of the process Topic Overview: Give you an integer column of length n. Please use Quick Sort to sort this column from smallest to larges ...

Posted by dspeer on Fri, 22 Apr 2022 20:02:54 +0300

N states of prime number solution

Introduction of this issue πŸ– This paper mainly introduces how to quickly screen prime numbers, and explains in detail the N states of trial division and screening πŸ‘€. catalogue πŸ– prefaceTrial division Realm 1 (Trial Division from 2 - (n-1))Realm 2 (excluding the sum of multiples of 2)Realm 3 (Trial Division from 2 to sprt(n)) Screenin ...

Posted by bdbush on Thu, 21 Apr 2022 20:42:58 +0300

[C language] array

1, One dimensional array creation and initialization. 1. An array is a collection of elements of the same type. How to create an array: type_t arr_name [const_n]; //type_t is the element type of the index group //const_n is a constant expression that specifies the size of the array Instance of array creation: //Code 1 int arr1[1 ...

Posted by bigMoosey on Wed, 20 Apr 2022 09:43:33 +0300