当前位置:网站首页>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;
边栏推荐
- Es module and commonjs learning notes
- Basic knowledge points
- 【论文笔记】Multi-Goal Reinforcement Learning: Challenging Robotics Environments and Request for Research
- Three dimensional dice realize 3D cool rotation effect (with complete source code) (with animation code)
- 发现一个很好的 Solon 框架试手的教学视频(Solon,轻量级应用开发框架)
- National teacher qualification examination in the first half of 2022
- 十年不用一次的JVM调用
- Database under unity
- Solon Logging 插件的添加器级别控制和日志器的级别控制
- PMP candidates, please check the precautions for PMP examination in July
猜你喜欢
小程序直播+电商,想做新零售电商就用它吧!
How to choose a panoramic camera that suits you?
National teacher qualification examination in the first half of 2022
LeetCode之單詞搜索(回溯法求解)
[转]: OSGI规范 深入浅出
Learning notes of "hands on learning in depth"
[轉]: OSGI規範 深入淺出
服务熔断 Hystrix
Data is stored in the form of table
Unity ugui source code graphic
随机推荐
对象的序列化
cocos_ Lua listview loads too much data
C4D simple cloth (version above R21)
A three-dimensional button
2022/7/1 learning summary
Lua determines whether the current time is the time of the day
Unity3d learning notes
Cocos2dx Lua registers the touch event and detects whether the click coordinates are within the specified area
使用命令符关闭笔记本自带键盘命令
How much do you know about 3DMAX rendering skills and HDRI light sources? Dry goods sharing
Unity find the coordinates of a point on the circle
Solon Logging 插件的添加器级别控制和日志器的级别控制
win下一键生成当日的时间戳文件
[turn]: OSGi specification in simple terms
FVP和Juno平台的Memory Layout介绍
Research on the value of background repeat of background tiling
Heap sort summary
Reverse one-way linked list of interview questions
Collapse of adjacent vertical outer margins
2021-10-29