Friday, December 01, 2006

Array vs. ArrayList

Below is some comparison between array and linklist:

Space utilization: Array is allocate in compile time, and the size of array is fixed while linklist is allocated in runtime, such that its size can be dynamic. Array could waste space since it is a fixed size.

Modification: It much easier to add/remove element in a linklist, however, when it is not easy to remove element in an array. Programmer can do that through shifting.

Accessing: Array is faster than linklist in term of accessing. Array using index to help maintain datastructure.

No comments: