C language learning (dynamic memory allocation and string)
Dynamic memory allocation:
malloc function:
To add header file #inclde < stdlib. H >Format: void*malloc (size_t size);The size of the space requested from malloc is in bytesThe returned result is void, which requires type transformation For example, a = (int *) malloc (variable or number * number);
#inc ...
Posted by dazraf on Sat, 23 Oct 2021 04:20:54 +0200
Binary tree and binary search tree of basic algorithm summary
1, Tree definition
In computer science, tree (English: tree) is an abstract data type (ADT) or a data structure that implements this abstract data type, which is used to simulate a data set with the nature of tree structure. It is a set with hierarchical relationship composed of n (n > 0) finite nodes. It is called "tree" because ...
Posted by jordanwb on Wed, 20 Oct 2021 04:54:08 +0200
Codeforces 1312E. Array Shrinking (interval DP stack)
linkkk
Meaning:
Give a length of
n
n
The sequence of n for the same two adjacent numbers
x
x
x can be replaced by a number
x
+ ...
Posted by Nexy on Tue, 19 Oct 2021 23:28:07 +0200
Non recursive traversal algorithm of binary tree
Non recursive traversal algorithm of binary tree
Traversal of binary tree refers to accessing each node of binary tree, and each node is accessed only once. The traversal of binary tree can be divided into four ways according to the composition of binary tree and the order of accessing nodes: first order traversal, middle order traversal, s ...
Posted by aleigh on Tue, 19 Oct 2021 02:23:39 +0200
Data structure and algorithm notes 1 (python)
Data structure and algorithm notes 1 (python)
Proposed algorithm
Concept of algorithm
Algorithm is the essence of computer processing information, because computer program is essentially an algorithm to tell the computer the exact steps to perform a specified task. Generally, when the algorithm is processing information, it will read the dat ...
Posted by TalonFinsky on Tue, 19 Oct 2021 01:18:14 +0200
Python implementation of common sorting algorithms
Common sorting algorithms
Algorithm: a calculation process and a method to solve the problemProgram = data structure + algorithm
1, Basic concepts of algorithm
1. Time complexity
How to reflect the speed of the algorithm?
The time complexity is expressed by the number of runs
Example:
'''
No one answers the problems encountered in learn ...
Posted by MilesStandish on Mon, 18 Oct 2021 20:31:28 +0200
On blocking queue
1. What is a blocking queue?
The first is a queue. The second is blocking. In the producer consumer model, the producer produces while the consumer consumes, so imagine these two threads as two threads, one is plugging in and the other is taking out.
When the production thread is full and the consumption thread is not taken out in time, ...
Posted by Bret on Sat, 16 Oct 2021 08:51:14 +0200
Recognize the list and perform various operations on the list
1. Awareness list
1) The list is the container data type, with [] as the container flag, and the elements inside are separated by commas: [element 1, element 2, element 3,..., element n]
2) Features:
The list is variable. The number of elements, the value of elements, and the order of elements in the list.
The list is ordered - subscript op ...
Posted by Skeptical on Sat, 16 Oct 2021 02:49:32 +0200
Zero based data structure: Li Chao line segment tree
Add a line segment to the plane. Note that the label of the inserted line segment in article i is, and the two endpoints of the line segment are
(
x
0
,
y
...
Posted by tnkannan on Fri, 15 Oct 2021 21:30:00 +0200
C language - Advanced pointer
1, Array parameter, pointer parameter
When writing code, it is inevitable to pass [array] or [pointer] to the function. How to design the parameters of the function?
1. One dimensional array parameter transfer
void test(int arr[])//ok
{}
void test(int arr[10])//ok
{}
void test(int* arr)//ok
{}
void test2(int* arr[20])//ok
{}
void test2(i ...
Posted by Dave100 on Thu, 14 Oct 2021 21:17:05 +0200