当前位置:网站首页>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 )
边栏推荐
- Four common ways and performance comparison of ArrayList de duplication (jmh performance analysis)
- Redistemplate common collection instructions opsforzset (VI)
- Replace Internet TV set-top box application through digital TV and broadband network
- The underlying implementation of string
- Binary tree node at the longest distance
- NPM run dev start project error document is not defined
- JS learning notes OO create suspicious objects
- The role of applicationmaster in spark on Yan's cluster mode
- One line by line explanation of the source code of anchor free series network yolox (a total of ten articles, you can change the network at will after reading it, if you won't complain to me)
- 20 large visual screens that are highly praised by the boss, with source code templates!
猜你喜欢
PostgreSQL 安装gis插件 CREATE EXTENSION postgis_topology
Aggregate function with key in spark
【力扣刷题】32. 最长有效括号
Happy sound 2[sing.2]
ViT论文详解
1292_FreeROS中vTaskResume()以及xTaskResumeFromISR()的实现分析
3D face reconstruction: from basic knowledge to recognition / reconstruction methods!
[in depth learning] pytorch 1.12 was released, officially supporting Apple M1 chip GPU acceleration and repairing many bugs
红杉中国,刚刚募资90亿美元
guava:Collections. The collection created by unmodifiablexxx is not immutable
随机推荐
Five wars of Chinese Baijiu
Absolute primes (C language)
Binary tree node at the longest distance
JS learning notes OO create suspicious objects
Quick news: the flybook players' conference is held online; Wechat payment launched "education and training service toolbox"
华为在多个行业同时出击,吓人的技术让欧美企业瑟瑟发抖
Sparkshuffle process and Mr shuffle process
[go][转载]vscode配置完go跑个helloworld例子
[Chongqing Guangdong education] Tianjin urban construction university concrete structure design principle a reference
红杉中国,刚刚募资90亿美元
LeetCode:1189. The maximum number of "balloons" -- simple
What about the spectrogram
Persistence / caching of RDD in spark
string的底层实现
Guava: three ways to create immutablexxx objects
基于InsightFace的高精度人脸识别,可直接对标虹软
Earned value management EVM detailed explanation and application, example explanation
Uni app app half screen continuous code scanning
Realization of epoll reactor model
Torch Cookbook