heres a question: i understand that array insertion is carried out in constant time - O(1) - but if the array is 2D (n*n), then would this still hold true if i wanted to insert the same value into each array?
let me explain a bit better, if i have a 2D array of ints, and the array looks like this:
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
and i wanted to add a 6 onto the end of each array, plus an extra line (so the array size is still n*n) so it ended up looking like this:
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
then i would say that the insertion into the first line is achieved in constant (1) time - but there are n lines! so i think this is now 1*n =n. so is this linear? or is it still thought of as constant?