Array vs Linked List

Source: Internet
Author: User

Access:random/sequential

1. Array element can be randomly accessed using index

2. Random access for element of linked list costs O (n) time

3. Generally, in linked list, elements is accessed sequentially

Memory Structure

1. Elements of array is stored in contiguous memoery locations.

2. Elements of linked list is stored at any available location. But the pointer to the memory location is stored in Previous Node.

Insertion/deletion

Array takes more time.

Linked List takes O (1) time.

Memory Allocation

1. For array, memory should is allocated at Compile-time.

2. For linked list, memory can is allocated at Run-time.

Array vs 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: info-contact@alibabacloud.com 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.