What would be the time complexity associated with concatenating arrays? Not merging them as in merge sort, but simply concatenating them using System.arraycopy(). Thanks.
-
What do you think it would be? Why do you think so? Why do you have doubts?Sotirios Delimanolis– Sotirios Delimanolis2014-08-25 21:22:04 +00:00Commented Aug 25, 2014 at 21:22
-
1Surely, it's just adding to the new array with all the entries of the other? Which would be O(n).Rudi Kershaw– Rudi Kershaw2014-08-25 21:22:07 +00:00Commented Aug 25, 2014 at 21:22
-
^That's what I think, but I'm trying to ask for expertise from someone who might know more about the inner workings of the function.Ruben Martinez Jr.– Ruben Martinez Jr.2014-08-25 21:23:16 +00:00Commented Aug 25, 2014 at 21:23
-
read this question stackoverflow.com/questions/18638743/…Tareq Salah– Tareq Salah2014-08-25 21:24:17 +00:00Commented Aug 25, 2014 at 21:24
-
1@StriplingWarrior - On second thoughts agreed. And besides that, after a little digging around the implementation of arraycopy() is platform dependent so there probably isn't a single canonical answer anyway.Rudi Kershaw– Rudi Kershaw2014-08-25 21:34:26 +00:00Commented Aug 25, 2014 at 21:34
|
Show 2 more comments