//网上一个数据结构视频,自己做的笔记
⒈ in terms of time complexity
①array : O(1)
②linked list : O(n)
⒉Requirements
①array
- fixed size
- memory may not be available as one large block
- if you need to access elements in the list all the time
②linked list
- no unused memory
- extra memory for pointer variable
- memory may be available as multiple small blocks
⒊cost of inserting an element in the list
(deleting an element will also have these three scenarios, and the time complexity will also be the same)
(ⅰ) array (also include the possible use of array as dynamic list)
(ⅱ)linked list
☑three scenarios in insertion:
Ⅰinsert an element at the beginning of the list
(ⅰ) have to shift each element by one position towards the higher index
☞th