-2

I know that when it comes to search operation ArrayList is better. And when it comes to insertion and deletion operation LinkedList is better. But I have read that linked list will cause memory overhead. In that case is it still safe to use LinkedList. Is so in what situation we have to avoid using LinkedList even though our logic contains more of insertion and deletion operation

Rashmi
  • 271
  • 1
  • 2
  • 11

1 Answers1

0

ArrayList is fast in search (iterating over elements), but LinkedList is fast in modifying (deleting, inserting in any position). Now it depends on you that what are you doing.

You can also refer to this stackoverflow answer

Community
  • 1
  • 1
Bahramdun Adil
  • 5,907
  • 7
  • 35
  • 68
  • Thanks Adil, I know this differance. And I have mentioned this differance above.But LinkedList has the risk of memory overhead. In that case how to make sure its is not affecting – Rashmi Feb 24 '16 at 09:42