Linked List vs ArrayList

Ilknur Eren
FAUN — Developer Community 🐾
2 min readOct 22, 2018

--

Linked List is a data structure that represents a sequence of nodes. In a singly linked list, each node points to the next node in the linked list. A doubly linked list gives each node pointers to both the next node and the previous node. Unlike an array, a linked list does not provide constant-time access to a particular “index” within the list. This means that if you want to find the Kth element in the list, you will need to iterate through K elements.

The benefit of a linked list is that you can add and remove items from the beginning of the list in constant time. We access the linked list through a reference to the head node of the linked list. When you implement the linked list this way, you need to be a bit careful. What if multiple objects need a reference to the linked list, and then the head of the linked list changes. Some objects might still be pointing to the old head. A number of linked list problems rely on recursion.

Linked List

Array List — In some languages, arrays (often called lists in this case) are automatically resizable. The array or list will grow as you append items. In some languages like Java, arrays are fixed length. The size is defined when you create the array.

ArrayList

Follow us on Twitter 🐦 and Facebook 👥 and Instagram 📷 and join our Facebook and Linkedin Groups 💬.

To join our community Slack team chat 🗣️ read our weekly Faun topics 🗞️, and connect with the community 📣 click here⬇

If this post was helpful, please click the clap 👏 button below a few times to show your support for the author! ⬇

--

--