当前位置:网站首页>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 )
边栏推荐
- b站视频链接快速获取
- Leetcode topic [array] -118 Yang Hui triangle
- 3D face reconstruction: from basic knowledge to recognition / reconstruction methods!
- Method return value considerations
- PostgreSQL 安装gis插件 CREATE EXTENSION postgis_topology
- What is the RDD operator in spark
- ViT论文详解
- Mysql相关术语
- JPEG2000 matlab source code implementation
- Divide candy
猜你喜欢
Method return value considerations
用aardio写一个旋转验证码标注小工具
一行代码可以做些什么?
Why rdd/dataset is needed in spark
Five wars of Chinese Baijiu
红杉中国,刚刚募资90亿美元
[Digital IC manual tearing code] Verilog automatic beverage machine | topic | principle | design | simulation
袁小林:安全不只是标准,更是沃尔沃不变的信仰和追求
Z function (extended KMP)
Fastjson parses JSON strings (deserialized to list, map)
随机推荐
mysql根据两个字段去重
Why is the cluster mode of spark on Yan better than the client mode
【力扣刷题】一维动态规划记录(53零钱兑换、300最长递增子序列、53最大子数组和)
Tiktok will push the independent grass planting app "praiseworthy". Can't bytes forget the little red book?
Efficiency tool +wps check box shows the solution to the sun problem
guava:Collections. The collection created by unmodifiablexxx is not immutable
[daily] win10 system setting computer never sleeps
Sdl2 source analysis 7: performance (sdl_renderpresent())
Mysql相关术语
1D convolution detail
PostgreSQL install GIS plug-in create extension PostGIS_ topology
[Chongqing Guangdong education] Information Literacy of Sichuan Normal University: a new engine for efficiency improvement and lifelong learning reference materials
技术分享 | 抓包分析 TCP 协议
bat脚本学习(一)
MySQL - 事务(Transaction)详解
Basic introduction of figure
Set up a time server
In JS, string and array are converted to each other (I) -- the method of converting string into array
JS learning notes OO create suspicious objects
Reptile practice (V): climbing watercress top250