当前位置:网站首页>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;
边栏推荐
- Unity and database
- 2022上半年全国教师资格证下
- Research on the value of background repeat of background tiling
- Grail layout and double wing layout
- 《动手学深度学习》学习笔记
- 2021-10-29
- 54. Spiral matrix & 59 Spiral matrix II ●●
- UE fantasy engine, project structure
- Data is stored in the form of table
- Reverse one-way linked list of interview questions
猜你喜欢
[trans]: spécification osgi
Leetcode word search (backtracking method)
Unity check whether the two objects have obstacles by ray
54. Spiral matrix & 59 Spiral matrix II ●●
Fragment addition failed error lookup
Stm32cubemx (8): RTC and RTC wake-up interrupt
Data is stored in the form of table
3dsmax scanning function point connection drawing connection line
669. Prune binary search tree ●●
Magnifying glass effect
随机推荐
Pause and resume of cocos2dx Lua scenario
Reverse one-way linked list of interview questions
JVM call not used once in ten years
Unity sends messages and blocks indecent words
UE 虚幻引擎,项目结构
Download and use of font icons
win10虚拟机集群优化方案
GBase数据库助力湾区数字金融发展
win下一键生成当日的时间戳文件
Solon Logging 插件的添加器级别控制和日志器的级别控制
BUUCTF MISC
Cocos2dx screen adaptation
Magnifying glass effect
Download xftp7 and xshell7 (official website)
2021-10-29
Unity and database
[轉]: OSGI規範 深入淺出
Unity ugui source code graphic
《动手学深度学习》学习笔记
How to choose a panoramic camera that suits you?