different list and array
- Could there be general differences between the data list and array types irrespective of the programming language? In particular, by way of access to elements?
- In Python, what's a "right" list -- list or tuple?
- Which of these structures requires more memory and under what conditions?
Laycee last edited by
Strictly speaking, link list and range are different data structures that are not linked to a specific programming language.
Massive is a combination of single-type data that are continuously stored. Access to the element is performed on the index per unit
O(1)- we're talking directly to the right area of memory.
On average, access to an element on a linked list
O(N)by overtaking the elements in search of the right. Methods of access to elements differ in implementation and from the programming language. Like Java in standard class.
LinkedListdepending on the situation, the passage of the elements may begin from the beginning and end of the list. The search for the element can be done both by index and by component.
The link list requires large memory costs under other equal conditions by retaining the indexes on the following/former elements and features of internal implementation.
As for Python: https://wiki.python.org/moin/TimeComplexity :
Internally, a list is represented as an array; the largest costs come from growing beyond the current allocation size (because everything must move), or from inserting or deleting somewhere near the beginning (because everything after that must move).
As I can see, internally
listis a mass,