The difference between ArrayList and LinkedList

Briefly describe the difference between ArrayList and LinkedList

The differences between ArrayList and LinkedList are as follows:

  1. ArrayList is a data structure based on a dynamic array, and LinkedList is a data structure based on a linked list;
  1. For random access to get and set, ArrayList is better than LinkedList, because LinkedList needs to move the pointer;
  1. For the add and remove operations, generally everyone will say that LinkedList is faster than ArrayList because ArrayList needs to move data. But the actual situation is not the case. For adding or deleting, LinkedList and ArrayList cannot clearly indicate who is fast and who is slow.

Guess you like

Origin blog.csdn.net/qq_40694640/article/details/112969158