An array or a linked list?

Source: Internet
Author: User

1. What are arrays and linked lists?

Arrays and linked lists are 2 of this different data structure. Data structures can be simply understood as the relationships between them. An array is a structure of connections in memory, and a linked list can be a discontinuous structure. There are other differences between the two:

A. Arrays are statically allocated content, and linked lists are dynamically allocated memory.

B. To get the nth element in the structure according to the subscript, the time of the array is read as O (1) and the complexity of the list is O (n).

C. To revise the nth element, the time complexity of the array is O (n), the time of the linked list is read as O (1)

2. Graph comparison:


An array or a linked list?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.