Which one is faster numpy array or list? Explain?



Suraj Said

+0 -0

Numpy array is more faster then list because numpy array is a collection homogeneous element (same datatype) and having contiguous memory allocation.
List is collection of non- homogeneous element (different datatype) and having non-contiguous memory allocation sometimes e.g [1,"SmallCode"],so if char take one byte and int takes 2 byte the then,list takes 2 bytes , 9 bytes and it is not having contiguous memory allocation.



Submit Your Response