Skip to main content
Data Structure Basic 数据结构基础

Data Structure Basic 数据结构基础

The storage of data

There are only two ways to storage the data, the Array and the Linked list. All the other data structures are developed based on them.

Arrays, due to their compact and contiguous storage, allow for random access, enabling quick retrieval of elements by index. Moreover, they are relatively space-efficient. However, because of their contiguous storage, memory space must be allocated all at once. This means that if you want to expand an array, you need to reallocate a larger block of memory and copy all the data to it, resulting in a time complexity of O(N). Additionally, if you want to insert or delete elements in the middle of an array, you must shift all the data behind it to maintain continuity, also resulting in a time complexity of O(N).


Yujie LiuAbout 3 minComputer ScienceAlgorithmsData Structure