当前位置:网站首页>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 )

边栏推荐
- string的底层实现
- Absolute primes (C language)
- Replace Internet TV set-top box application through digital TV and broadband network
- What is the RDD operator in spark
- Univariate cubic equation - relationship between root and coefficient
- 爬虫实战(五):爬豆瓣top250
- 【力扣刷题】一维动态规划记录(53零钱兑换、300最长递增子序列、53最大子数组和)
- 1292_FreeROS中vTaskResume()以及xTaskResumeFromISR()的实现分析
- Efficiency tool +wps check box shows the solution to the sun problem
- The underlying implementation of string
猜你喜欢

中国白酒的5场大战

Earned value management EVM detailed explanation and application, example explanation

抖音將推獨立種草App“可頌”,字節忘不掉小紅書?
![关于char[]数组通过scanf赋值使用上的一些问题。。](/img/cf/d85a3172c5d29ac00377f9c30dbc4f.png)
关于char[]数组通过scanf赋值使用上的一些问题。。

Persistence / caching of RDD in spark

What can one line of code do?

Microsoft technology empowerment position - February course Preview

PostgreSQL install GIS plug-in create extension PostGIS_ topology
Why does MySQL index fail? When do I use indexes?

抖音将推独立种草App“可颂”,字节忘不掉小红书?
随机推荐
JS学习笔记-OO创建怀疑的对象
Technology sharing | packet capturing analysis TCP protocol
NPM run dev start project error document is not defined
强化学习-学习笔记5 | AlphaGo
技术分享 | 抓包分析 TCP 协议
美国科技行业结束黄金时代,芯片求售、裁员3万等哀声不断
guava:Collections. The collection created by unmodifiablexxx is not immutable
Torch Cookbook
Absolute primes (C language)
FZU 1686 龙之谜 重复覆盖
Broadcast variables and accumulators in spark
Sql: stored procedures and triggers - Notes
Description of web function test
It's not my boast. You haven't used this fairy idea plug-in!
中国白酒的5场大战
ROS error: could not find a package configuration file provided by "move_base“
The relationship between root and coefficient of quadratic equation with one variable
Microsoft technology empowerment position - February course Preview
Sdl2 source analysis 7: performance (sdl_renderpresent())
MPLS experiment