What is difference between arraylist and linkedlist?
Answer / Mohit Kumar Gupta
ArrayList and LinkedList are both implementations of the List interface in Java, but they differ in their internal structure and performance characteristics:
1. Internal Structure: ArrayList uses an array to store elements, while LinkedList uses a chain of nodes (linked list).
2. Performance: Accessing an element by index in ArrayList is faster due to its array-based implementation, whereas inserting or deleting elements at the beginning or middle of an ArrayList is slower.nOn the other hand, adding and removing elements from the beginning or middle of LinkedList is faster than Arraylist because it only requires changing pointers.
| Is This Answer Correct ? | 0 Yes | 0 No |
What differences exist between hashmap and hashtable?
Why do we use collections?
Why do we use hashset?
What is a circular singly linked list?
What is link list in data structure?
Differentiate between list and set.
What are some of the best practices relating to the java collection framework?
What is the default capacity of hashmap?
What does args stand for?
What is the difference between set and unordered_set?
Where is data structure used?
What are binary search and fibonacci search?