首页 > 其他 > 详细

Array vs Linked List

时间:2015-10-30 07:00:54      阅读:239      评论:0      收藏:0      [点我收藏+]

技术分享

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 are 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 be allocated at Compile-Time.

2. For linked list, memory can be allocated at Run-Time.

 

Array vs Linked List

原文:http://www.cnblogs.com/ireneyanglan/p/4922274.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!