An array is a collection of elements of the same data type that are stored contiguously in memory. Each element can be accessed using its index, an integer value representing its position in the array.
Operations:
Accessing an element: O(1)
Inserting an element: O(n)
Deleting an element: O(n)
Time complexity analysis:
Accessing an element: O(1)
Inserting an element: O(n)
Deleting an element: O(n)
Space complexity: O(n)
Continue this lesson in the app
Install CourseHive on Android or iOS to keep learning while you move.