

I see the question as being the opposite. Performance-wise, arraylists are slower than raw arrays. Net) give you the benefits of arrays, but dynamically allocate resources for you so that you don't need to worry too much about list size and you can delete items at any index without any effort or re-shuffling elements around. Each linked list node requires the data as well as one (or more) pointers to the other elements in the linked list.Īrray Lists (like those in. Each element in the array is just the data. Filled arrays take up less memory than linked lists. You can use pointer math on the array to access each element, whereas you need to lookup the node based on the pointer for each element in linked list, which may result in page faults which may result in performance hits. You need speed when iterating through all the elements in sequence. You know the number of elements in the array ahead of time so that you can allocate the correct amount of memory for the array You need indexed/random access to elements You want to be able to insert items in the middle of the list (such as a priority queue)

You don't need random access to any elements

With arrays, you may need to re-declare and copy memory if the array grows too big You don't know how many items will be in the list. You need constant-time insertions/deletions from the list (such as in real-time computing where time predictability is absolutely critical) Linked lists are preferable over arrays when:
