René's URL Explorer Experiment


Title: Array 与Linked List有什么区别,分别适用于哪一些场景? · Issue #4 · CodeRookie262/JavaScript-Algorithm-Training · GitHub

Open Graph Title: Array 与Linked List有什么区别,分别适用于哪一些场景? · Issue #4 · CodeRookie262/JavaScript-Algorithm-Training

X Title: Array 与Linked List有什么区别,分别适用于哪一些场景? · Issue #4 · CodeRookie262/JavaScript-Algorithm-Training

Description: 数据结构中有线性表与非线性表之分,线性表主要有Array,Linked List,Queue,Stack,非线性表有Graph,Tree,其中 Array 与 Linked List 都属于数据结构线性表。 先说说Array与Linked List 的特性吧~ Array(数组) 什么是数组呢? 数组是一种线性数据结构,它用一组连续的内存空间来存储具有相同类型的数据。 线性数据结构 用一组连续的内存空间进行存储相同类型的值 因为有了第二点的支持,让数组有一个天然的优势就...

Open Graph Description: 数据结构中有线性表与非线性表之分,线性表主要有Array,Linked List,Queue,Stack,非线性表有Graph,Tree,其中 Array 与 Linked List 都属于数据结构线性表。 先说说Array与Linked List 的特性吧~ Array(数组) 什么是数组呢? 数组是一种线性数据结构,它用一组连续的内存空间来存储具有相同类型的数据。 线性数据结构 用一组连...

X Description: 数据结构中有线性表与非线性表之分,线性表主要有Array,Linked List,Queue,Stack,非线性表有Graph,Tree,其中 Array 与 Linked List 都属于数据结构线性表。 先说说Array与Linked List 的特性吧~ Array(数组) 什么是数组呢? 数组是一种线性数据结构,它用一组连续的内存空间来存储具有相同类型的数据。 线性数据结构 用一组连...

Opengraph URL: https://github.com/CodeRookie262/JavaScript-Algorithm-Training/issues/4

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Array 与Linked List有什么区别,分别适用于哪一些场景?","articleBody":"数据结构中有线性表与非线性表之分,线性表主要有Array,Linked List,Queue,Stack,非线性表有Graph,Tree,其中 Array 与 Linked List 都属于数据结构线性表。\r\n先说说Array与Linked List 的特性吧~\r\n\r\n#### Array(数组)\r\n什么是数组呢?\r\n数组是一种**线性数据结构**,它用一组**连续的内存空间**来存储具有**相同类型**的数据。\r\n\r\n- 线性数据结构\r\n- 用一组连续的内存空间进行存储相同类型的值\r\n\r\n因为有了第二点的支持,让数组有一个天然的优势就是支持任意访问,也就是可以通过索引直接获取到对应的储存数据,可以说是数组的杀手锏,但是这个杀手锏是数组的亮点的同时也暴露了数组的弊端,那就是如果要支持任意访问这一特性的话就得保证**数据类型一致性**和**内存的连续性**。这使得数组在删除或者插入数据的时候为了保证连续性而做大量的数据迁移工作;\r\n\r\n假设有一个数组`[1,2,3,4,5,6]`,我们对它分别进行插入,删除操作:\r\n\r\n\u003e 插入操作\r\n1. 如果我们要把`0`插入到数组的第三个位置的话,就得把`3,4,5,6`都往后移动。\r\n2. 如果我们在数组的第一个位置插入新的数据,那么原先数组的每个数组都得完后迁移。\r\n3. 如果我们是在数组的尾部插入数据,此时因为新增元素后面没有元素存在,并不重要对数据进行迁移。\r\n\r\n可以看出数组插入元素的复杂度是`O(n)`。\r\n\r\n\u003e 删除操作\r\n\r\n删除操作同插入操作差不多,复杂度也是`O(n)`。\r\n\r\n但是虽然数组的插入和删除复杂度是`O(1)`,但是对于一些特殊的场景我们还是可以优化成`O(1)`。例如插入操作中,如果数组不看重有序度的话可以将新元素即将插入的位置中的原数组迁移到数组尾部后再进行插入,这样就不用进行大量的数据迁移啦;对于删除操作我们可以先标记删除的元素,待到数组储存个数即将到达上限时在一次性对删除的元素进行删除。\r\n\r\n可以看出数组的优点在于它强大的**任意访问**,缺点在于插入和删除过于低效,所以这个时候就可以用到我们另外一个大兄嘚**Linked List**(链表)。\r\n\r\n#### Linked List(链表)\r\n\r\n相比数组而言,链表储存数据不需要连续的内存空间,链表的每个节点是一个内存块(JS中可以理解为对象)它比数组占用的内存会更大,但是可以通过节点中指针将一组散乱的内存块关联在一起,通过节点的指针进行遍历和访问所关联的节点。\r\n\r\n常见的链表的类别:**单链表**,**双向链表**和**循环链表**。\r\n\r\n因为链表的储存空间对内存连续性并没有要求,所以在插入和删除操作更为简单粗暴,复杂度是`O(1)`,但是它有一个缺点,就是没有数组天然的任意访问特性,导致它的查找操作复杂度为`O(n)`。\r\n\r\n对于大数据链来说如果频繁插入或者操作的话,链表比数组更为友好写,但是如果是任意访问的话,数组更为证据优势,不过链表也可以做一些优化提升的,例如可以使用`跳表`做到复杂度为`O(logN)`的访问,不过代价是空间复杂度是`O(n)`,对内存的消耗会大一些。\r\n\r\nArray 和 Linked List 都更有自己的优点和缺点,如果对内存允许的情况下可以考虑空间换时间,如果内存比较紧缺的时候可以考虑时间换空间,每一种方案都有自己的亮点。\r\n\r\n\u003e 复杂度对比\r\n\r\n时间复杂度| Array | Linked List\r\n--- | --- | --\r\n插入/删除 | O(n) | O(1)\r\n随机访问 | O(1) | O(n)\r\n\r\n\u003e 另外注意一点就是随意访问并非是查找,你就算要查找并且访问元素,用二分法的复杂度也得`O(logN)`,访问数组中的某个元素必须找到它的位置的前提,虽然说数组的随机访问为O(1),不过查找某个元素之前得明确它在数组中的位置才可以通过寻址地址访问到对应的元素呀。","author":{"url":"https://github.com/CodeRookie262","@type":"Person","name":"CodeRookie262"},"datePublished":"2020-12-19T10:19:22.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/4/JavaScript-Algorithm-Training/issues/4"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:b9657442-e61d-c29b-e903-aee69ead3d1d
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDC24:25602F:C13E589:FC1E337:6976661F
html-safe-nonce735d882c8510016e2c55591b9c215ce4b93f0df16cf2a4c8f314425dadd25e2d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQzI0OjI1NjAyRjpDMTNFNTg5OkZDMUUzMzc6Njk3NjY2MUYiLCJ2aXNpdG9yX2lkIjoiMzU1NDc0NjgwNDA0MzQwODkyNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacbcb3b7420b5a5654bb8821012533473690bdcb6117eff984bef8b1a4392d8f94
hovercard-subject-tagissue:771353101
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/CodeRookie262/JavaScript-Algorithm-Training/4/issue_layout
twitter:imagehttps://opengraph.githubassets.com/2522885081d2da6a1422ad70eb1ef41222bc81aaafb808e89670aa3b3fb30985/CodeRookie262/JavaScript-Algorithm-Training/issues/4
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/2522885081d2da6a1422ad70eb1ef41222bc81aaafb808e89670aa3b3fb30985/CodeRookie262/JavaScript-Algorithm-Training/issues/4
og:image:alt数据结构中有线性表与非线性表之分,线性表主要有Array,Linked List,Queue,Stack,非线性表有Graph,Tree,其中 Array 与 Linked List 都属于数据结构线性表。 先说说Array与Linked List 的特性吧~ Array(数组) 什么是数组呢? 数组是一种线性数据结构,它用一组连续的内存空间来存储具有相同类型的数据。 线性数据结构 用一组连...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameCodeRookie262
hostnamegithub.com
expected-hostnamegithub.com
None032152924a283b83384255d9489e7b93b54ba01da8d380b05ecd3953b3212411
turbo-cache-controlno-preview
go-importgithub.com/CodeRookie262/JavaScript-Algorithm-Training git https://github.com/CodeRookie262/JavaScript-Algorithm-Training.git
octolytics-dimension-user_id41562303
octolytics-dimension-user_loginCodeRookie262
octolytics-dimension-repository_id322202722
octolytics-dimension-repository_nwoCodeRookie262/JavaScript-Algorithm-Training
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id322202722
octolytics-dimension-repository_network_root_nwoCodeRookie262/JavaScript-Algorithm-Training
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release5b577f6be6482e336e3c30e8daefa30144947b17
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/CodeRookie262/JavaScript-Algorithm-Training/issues/4#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FCodeRookie262%2FJavaScript-Algorithm-Training%2Fissues%2F4
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FCodeRookie262%2FJavaScript-Algorithm-Training%2Fissues%2F4
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=CodeRookie262%2FJavaScript-Algorithm-Training
Reloadhttps://github.com/CodeRookie262/JavaScript-Algorithm-Training/issues/4
Reloadhttps://github.com/CodeRookie262/JavaScript-Algorithm-Training/issues/4
Reloadhttps://github.com/CodeRookie262/JavaScript-Algorithm-Training/issues/4
CodeRookie262 https://github.com/CodeRookie262
JavaScript-Algorithm-Traininghttps://github.com/CodeRookie262/JavaScript-Algorithm-Training
Notifications https://github.com/login?return_to=%2FCodeRookie262%2FJavaScript-Algorithm-Training
Fork 0 https://github.com/login?return_to=%2FCodeRookie262%2FJavaScript-Algorithm-Training
Star 9 https://github.com/login?return_to=%2FCodeRookie262%2FJavaScript-Algorithm-Training
Code https://github.com/CodeRookie262/JavaScript-Algorithm-Training
Issues 40 https://github.com/CodeRookie262/JavaScript-Algorithm-Training/issues
Pull requests 0 https://github.com/CodeRookie262/JavaScript-Algorithm-Training/pulls
Projects 0 https://github.com/CodeRookie262/JavaScript-Algorithm-Training/projects
Security 0 https://github.com/CodeRookie262/JavaScript-Algorithm-Training/security
Insights https://github.com/CodeRookie262/JavaScript-Algorithm-Training/pulse
Code https://github.com/CodeRookie262/JavaScript-Algorithm-Training
Issues https://github.com/CodeRookie262/JavaScript-Algorithm-Training/issues
Pull requests https://github.com/CodeRookie262/JavaScript-Algorithm-Training/pulls
Projects https://github.com/CodeRookie262/JavaScript-Algorithm-Training/projects
Security https://github.com/CodeRookie262/JavaScript-Algorithm-Training/security
Insights https://github.com/CodeRookie262/JavaScript-Algorithm-Training/pulse
New issuehttps://github.com/login?return_to=https://github.com/CodeRookie262/JavaScript-Algorithm-Training/issues/4
New issuehttps://github.com/login?return_to=https://github.com/CodeRookie262/JavaScript-Algorithm-Training/issues/4
Array 与Linked List有什么区别,分别适用于哪一些场景?https://github.com/CodeRookie262/JavaScript-Algorithm-Training/issues/4#top
Arrayhttps://github.com/CodeRookie262/JavaScript-Algorithm-Training/issues?q=state%3Aopen%20label%3A%22Array%22
Linked Listhttps://github.com/CodeRookie262/JavaScript-Algorithm-Training/issues?q=state%3Aopen%20label%3A%22Linked%20List%22
https://github.com/CodeRookie262
https://github.com/CodeRookie262
CodeRookie262https://github.com/CodeRookie262
on Dec 19, 2020https://github.com/CodeRookie262/JavaScript-Algorithm-Training/issues/4#issue-771353101
Arrayhttps://github.com/CodeRookie262/JavaScript-Algorithm-Training/issues?q=state%3Aopen%20label%3A%22Array%22
Linked Listhttps://github.com/CodeRookie262/JavaScript-Algorithm-Training/issues?q=state%3Aopen%20label%3A%22Linked%20List%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.