Hello this quesion is related to Java Please don\'t answer with your handwriting
ID: 3741343 • Letter: H
Question
Hello
this quesion is related to Java
Please don't answer with your handwriting
thank you
ArrayList is based on an Array data structure, while LinkedList is based on a Doubly Linked List data structure Compared to a LinkedList, storing elements in an ArrayList consumes less memory and generally gives faster access times. Adding or removing elements is usually faster for a LinkedList, but as you usually have to iterate to the position at which you want to add or remove an element, the performance loss for iterating to the correct position often prevails over the performance gain in adding or removing an element. However, there is no overall winner between ArrayList and LinkedList. Your specific requirements will determine which class to use. 8:16 PMExplanation / Answer
When to use ArrayList:
1. It is used when you need to dynamically store the elements.
2. It is better for storing and accessing data.
3. It acts as a list only because it implements List only.
When to use LinkedList:
1. It is used when to manipulating data.
2. It acts both as a list and queue because it implements List and Deque interfaces.
3. A double linked list is used to store data.
Thus manipulation with ArrayList is slow because the ArrayList is an array. So when any element is removed then all the bits are shifted in memory.
But with LinkedList it is faster because it uses doubly linked list so no bit shifting is required in memory.
**Comment for any further queries.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.