

























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


























Foo[0] Foo[1]
Foo[N-1]
myFooList
Objects
data[4]
=
29.95;
double[]
data
new
double[10];
fill
array
double[]
prices
data;
clone
double[]
prices
=
(double[])data.clone();
Question
Write your own version of arraycopy for int arrays
public static void arraycopy(int[] from,int fromstart, int[] to, int tostart, int count) {}
i,
data,
i
data.length
System.arraycopy(data,
i,
data,
i
data.length
System.arraycopy(data,
i,
data,
i
data.length
System.arraycopy(data,
i,
data,
i
data.length -
iiii
data[i]
x;
data[i]
x;
data[i]
x;
data[i]
x;
Docsity.com
Note that : A[i]= A[j] and A[j] = A[i] do not swap content
Exercise: Reverse an array using swaps