当前位置:网站首页>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 )
边栏推荐
- Persistence / caching of RDD in spark
- Is it important to build the SEO foundation of the new website
- Univariate cubic equation - relationship between root and coefficient
- [asp.net core] set the format of Web API response data -- formatfilter feature
- 麦趣尔砸了小众奶招牌
- Redistemplate common collection instructions opsforset (V)
- Method return value considerations
- Technology sharing | packet capturing analysis TCP protocol
- Search map website [quadratic] [for search map, search fan, search book]
- C language: comprehensive application of if, def and ifndef
猜你喜欢
Five wars of Chinese Baijiu
PostgreSQL 安装gis插件 CREATE EXTENSION postgis_topology
Method return value considerations
PostgreSQL install GIS plug-in create extension PostGIS_ topology
[Chongqing Guangdong education] Tianjin urban construction university concrete structure design principle a reference
JPEG2000-Matlab源码实现
It's not my boast. You haven't used this fairy idea plug-in!
数字化转型挂帅复产复工,线上线下全融合重建商业逻辑
Vit paper details
[Chongqing Guangdong education] Information Literacy of Sichuan Normal University: a new engine for efficiency improvement and lifelong learning reference materials
随机推荐
爬虫实战(五):爬豆瓣top250
guava:Collections.unmodifiableXXX创建的collection并不immutable
First batch selected! Tencent security tianyufeng control has obtained the business security capability certification of the ICT Institute
[Li Kou brushing questions] one dimensional dynamic planning record (53 change exchanges, 300 longest increasing subsequence, 53 largest subarray and)
The underlying implementation of string
Redistemplate common collection instructions opsforhash (IV)
Guava: three ways to create immutablexxx objects
MySQL - 事务(Transaction)详解
Technology sharing | packet capturing analysis TCP protocol
C# 如何在dataGridView里设置两个列comboboxcolumn绑定级联事件的一个二级联动效果
guava:Collections. The collection created by unmodifiablexxx is not immutable
Intelligent online customer service system source code Gofly development log - 2 Develop command line applications
JS学习笔记-OO创建怀疑的对象
Michael smashed the minority milk sign
基于InsightFace的高精度人脸识别,可直接对标虹软
1D convolution detail
互联网快讯:吉利正式收购魅族;胰岛素集采在31省全面落地
Yyds dry goods inventory C language recursive implementation of Hanoi Tower
Web开发小妙招:巧用ThreadLocal规避层层传值
guava: Multiset的使用