当前位置:网站首页>Double pointer Foundation
Double pointer Foundation
2022-07-05 05:16:00 【lee2813】
One 、 Double pointer
Double pointers are mainly used to traverse arrays , Two pointers point to different elements , Work together , Generally speaking, they are all in the same array .
Two 、 classification
According to the different problems , The direction of movement of the pointer will also be different , It can be divided into two situations :
- Traversal direction is the same and will not intersect
This kind of situation is generally used to solve the problem of searching a certain interval of the array , Also known as the sliding window problem . - The traversal direction is opposite and the array itself is orderly
This situation is generally used for element search
Applications can be divided into :
- Two number sum problem
- Merge two ordered arrays
- Speed pointer problem
- Sliding window problem
3、 ... and 、 A basic review of pointers
- const Heel int, Value cannot be changed , Pointer can be changed
const int * p2 = &x
- const Followed by a pointer p3 front , Value can be changed , The pointer cannot be changed
int * const p3 = &x
- const Heel int And a pointer p4, Value can be changed , The pointer cannot be changed
const int * const p4 = &x
*
Left Union , Therefore, it is a function whose return type is pointer
int * function(){
}
( )
hold*
Included , Andfunction
combination , Therefore, it is return ; Pointer of type function
int func2(int a,int b){
}
int (*function)(int,int) = func2;
边栏推荐
猜你喜欢
C语言杂谈1
Redis has four methods for checking big keys, which are necessary for optimization
Research on the value of background repeat of background tiling
PostgreSQL surpasses mysql, and the salary of "the best programming language in the world" is low
Unity get component
django连接数据库报错,这是什么原因
3dsmax scanning function point connection drawing connection line
Leetcode word search (backtracking method)
UE4/UE5 虚幻引擎,材质篇,纹理,Compression and Memory压缩和内存
win10虚拟机集群优化方案
随机推荐
Simple modal box
Judge the position of the monster in the role under unity3d
Ue4/ue5 illusory engine, material chapter, texture, compression and memory compression and memory
GameObject class and transform class of unity
FVP和Juno平台的Memory Layout介绍
Bucket sort
What is the agile proportion of PMP Exam? Dispel doubts
PMP candidates, please check the precautions for PMP examination in July
2020-10-27
Quick sort summary
Ue4/ue5 illusory engine, material part (III), material optimization at different distances
C language Essay 1
Pause and resume of cocos2dx Lua scenario
Under the national teacher qualification certificate in the first half of 2022
Download and use of font icons
[trans]: spécification osgi
669. Prune binary search tree ●●
使用Room数据库报警告: Schema export directory is not provided to the annotation processor so we cannot expor
Unity connects to the database
对象的序列化