What difference between ArrayList and LinkedList? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita

What difference between ArrayList and LinkedList?

4th Jul 2016, 10:46 PM
Amarjit Dhillon
Amarjit Dhillon - avatar
5 Respuestas
+ 1
When you can determine that you might need a Structure to store a few data types values only but you're not fully sure about the Size of the Structure; you will need to use the ArrayList Data Structure. ArrayList Data Structure facilitates rapid access to your values. When you are not sure about the Size of your Data Structure but have determined that you will need to perform many inserts and delete operation on your Data Structure; you will need to use the LinkedList Data Structure. LinkedList Data Structure also facilitates in between Data Addition and Deletion with ease.
6th Sep 2016, 11:57 AM
Naveen Karthik
Naveen Karthik - avatar
ArrayList and LinkedList are two popular collection classes in Java and Major difference between ArrayList and LinkedList is on there implementation while ArrayList uses index based Array LinkedList is implemented using Doubly Linked ListData Structure
8th Jul 2016, 8:18 PM
Ravi Jain
Ravi Jain - avatar
ArrayList is based on array, so when adding or smth else, you work with array. LinkedList is based on properties that have reference to next or previous element. You may read about their potential usage.
13th Jul 2016, 8:52 PM
Valeriy Posvistak
Valeriy Posvistak - avatar
Accessing elements are faster with ArrayList, because it is index based. But accessing is difficult with LinkedList. It is slow access. This is to access any element, you need to navigate through the elements one by one. But insertion and deletion is much faster with LinkedList, because if you know the node, just change the pointers before or after nodes. Insertion and deletion is slow with ArrayList, this is because, during these operations ArrayList need to adjust the indexes according to deletion or insetion if you are performing on middle indexes. Means, an ArrayList having 10 elements, if you are inserting at index 5, then you need to shift the indexes above 5 to one more.
13th Sep 2016, 11:38 AM
Piyush Tambe
Piyush Tambe - avatar
what is doubly linked list data structure?? can yu elaborate pls
6th Jan 2017, 7:12 PM
pons ponmudi
pons ponmudi - avatar