Time complexity of System.arraycopy(…)?

It will have to go through all the elements in the array to do this. Array is a unique data structure where you have to specify a size when you initialize it. Order would be the source array’s size or in Big O terms its O(length).

Infact this happens internally in an ArrayList. ArrayList wraps an array. Although ArrayList looks like a dynamically growing collection, internally it does an arrycopy when it has to expand.

Leave a Comment