当前位置:网站首页>Leetcode learning records (starting from the novice village, you can't kill out of the novice Village) ---1
Leetcode learning records (starting from the novice village, you can't kill out of the novice Village) ---1
2022-07-06 21:52:00 【Aspire to get a high salary】
Array overview
aggregate : Simply speaking , It can be said to be a whole composed of one or more elements . The types of elements that make up the set can be different , At the same time, these elements are also disordered .
list : It's a linear table . It consists of elements arranged together in a certain order , Is ordered . The common forms of lists are : Array 、 Linked list 、 Pile up 、 Stack .
Array : Array introduces the concept of index , You can find the position of the corresponding element by subscript . meanwhile , Due to the subscript , Prove that the data stored in the array is continuous . Unlike arrays , Linked lists are not continuous .
Array reading : According to the array subscript, you can find the corresponding element , Operate on only one data , So the time complexity is zero O(1).
Array search : Consider the worst case , If the data to be searched is at the end , Then you need to start from the 0 The position index goes all the way to the last index of the array . So the time complexity is O(N).
Array insertion : If you want to insert this element at the end of the array , Just one step . That is, the computer calculates the memory address of the element to be inserted through the length and position of the array , Then insert the element into the specified position . However , If you want to insert the element elsewhere in the array , There will be a difference , At this time, we first need to make room for the position where the element is to be inserted , Then insert it .
Array deletion : Deleting an element is similar to inserting an element , When we delete an element in the array , The array will leave vacancy The location of , The elements in the array are continuous in memory , This makes the following elements need to fill the position .
Example 1: Power button https://leetcode-cn.com/problems/find-the-middle-index-in-array/
Just started, I can only traverse ( I feel like I can't get out of the novice village )
边栏推荐
- 麦趣尔砸了小众奶招牌
- JS learning notes OO create suspicious objects
- Acdreamoj1110 (multiple backpacks)
- 华为在多个行业同时出击,吓人的技术让欧美企业瑟瑟发抖
- Efficiency tool +wps check box shows the solution to the sun problem
- [Digital IC manual tearing code] Verilog automatic beverage machine | topic | principle | design | simulation
- 数字化转型挂帅复产复工,线上线下全融合重建商业逻辑
- Caching strategies overview
- JPEG2000 matlab source code implementation
- [go][reprint]vscode run a HelloWorld example after configuring go
猜你喜欢
[asp.net core] set the format of Web API response data -- formatfilter feature
对话阿里巴巴副总裁贾扬清:追求大模型,并不是一件坏事
[daily] win10 system setting computer never sleeps
PostgreSQL modifies the password of the database user
numpy 下载安装
Yyds dry goods inventory C language recursive implementation of Hanoi Tower
Method return value considerations
JPEG2000 matlab source code implementation
Tiktok will push the independent grass planting app "praiseworthy". Can't bytes forget the little red book?
中国白酒的5场大战
随机推荐
C language char, wchar_ t, char16_ t, char32_ Relationship between T and character set
Tiktok will push the independent grass planting app "praiseworthy". Can't bytes forget the little red book?
Method return value considerations
Run the deep network on PI and Jetson nano, and the program is killed
Summary of cross partition scheme
[in depth learning] pytorch 1.12 was released, officially supporting Apple M1 chip GPU acceleration and repairing many bugs
14年本科毕业,转行软件测试,薪资13.5K
b站视频链接快速获取
Guava: use of multiset
Happy sound 2[sing.2]
High precision face recognition based on insightface, which can directly benchmark hongruan
红杉中国,刚刚募资90亿美元
Shake Sound poussera l'application indépendante de plantation d'herbe "louable", les octets ne peuvent pas oublier le petit livre rouge?
1D convolution detail
Start the embedded room: system startup with limited resources
Intelligent online customer service system source code Gofly development log - 2 Develop command line applications
The role of applicationmaster in spark on Yan's cluster mode
用aardio写一个旋转验证码标注小工具
Sdl2 source analysis 7: performance (sdl_renderpresent())
袁小林:安全不只是标准,更是沃尔沃不变的信仰和追求