create a new array with element i set to v. Grow the array in case i >= length.New array elements at indices array.this.length..i-1 will be set to z.Complexity: O(max(i, array.this.length))