What is difference between arraylist and linkedlist?



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

Post New Answer

More Data Structures Interview Questions

What differences exist between hashmap and hashtable?

1 Answers  


Why do we use collections?

1 Answers  


Why do we use hashset?

1 Answers  


What is a circular singly linked list?

1 Answers  


What is link list in data structure?

1 Answers  


Differentiate between list and set.

1 Answers  


What are some of the best practices relating to the java collection framework?

1 Answers  


What is the default capacity of hashmap?

1 Answers  


What does args stand for?

1 Answers  


What is the difference between set and unordered_set?

1 Answers  


Where is data structure used?

1 Answers  


What are binary search and fibonacci search?

1 Answers  


Categories