What is the worst case running time of declaring a 2D array? The 2d array is not strictly square. I have seen answers that state it is O(n) and I have also seen answers that state its O(n²).
In my mind, when declaring an object array such as this:
Object[][] gridArray = new Object[i][j];
//The number of elements n = i*j
The time complexity when declaring the array should be O(n) as it will just scale linearly depending on how many elements there will be. Am I missing something?