当前位置:网站首页>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;
边栏推荐
猜你喜欢
C4D simple cloth (version above R21)
Django reports an error when connecting to the database. What is the reason
Merge sort
UE fantasy engine, project structure
LeetCode之單詞搜索(回溯法求解)
[轉]: OSGI規範 深入淺出
National teacher qualification examination in the first half of 2022
Quick sort summary
Simple modal box
Magnifying glass effect
随机推荐
669. Prune binary search tree ●●
[转]MySQL操作实战(一):关键字 & 函数
Merge sort
3dsmax scanning function point connection drawing connection line
How to choose a panoramic camera that suits you?
Unity shot tracking object
Research on the value of background repeat of background tiling
Unity3d learning notes
Lua GBK and UTF8 turn to each other
支持多模多态 GBase 8c数据库持续创新重磅升级
Embedded database development programming (VI) -- C API
Vs2015 secret key
Applet Live + e - commerce, si vous voulez être un nouveau e - commerce de détail, utilisez - le!
FVP和Juno平台的Memory Layout介绍
Listview is added and deleted at the index
UE4/UE5 虚幻引擎,材质篇,纹理,Compression and Memory压缩和内存
When will Wei Lai, who has been watched by public opinion, start to "build high-rise buildings" again?
Es module and commonjs learning notes
嵌入式数据库开发编程(五)——DQL
Chinese notes of unit particle system particle effect