This data structure organizes data in memory in a sequential manner where data is stored in consecutive memory locations. Because Arrays are mostly used data structures they come inbuilt in many programming languages.In JavaScript, arrays are objects which makes then reference types because they are not primitive types, they are created by the programmer. Arrays are stored in adjucent blocks of memory.
Iet arr[2] has time complexity of O(1) because the comp know exactly where the data is (at index 2)
Arr.push(“z”) has time complexity of O(1) because the computer knows the last index.
Can be O(n) for static arrays(has fixed size to add to this array the entire array is copied to a new location with more memory) even with dynamic arrays at rear times.
Arr.pop(“z”) has time complexity of O(1) because the computer knows the last index
Insertion with arrays has bigO of O(n) because it has to loop through the rest of the array elements to change there indices
Adding and removing elements at the beginning of the array has bigO of O(n) because it has to loop through the rest of the array elements to change there indices
Deleting elements from an array has bigO(n) because it has to loop through the rest of the array elements to change there indices. So arrays are good for access and adding elements at the end.