I'm trying to convert a function that i had that quickSorted an array into a vector quicksort function. I keep getting this cannot find symbol. This is my function that im trying to adapt into vector quickSort
public static void quickSort(Vector<Personne> arr, int low, int high, Personne[] pers) {
if (arr.isEmpty() == true || arr.size()== 0)
return;
if (low >= high)
return;
int middle = low + (high - low) / 2;
int pivot = arr.get(middle).getNumero();
int i = low, j = high;
while (i <= j) {
while (arr.get(i).getNumero() < pivot) {
i++;
}
while (arr.get(j).getNumero() > pivot) {
j--;
}
if (i <= j) {
Vector<Personne> temp = new Vector<Personne>();
temp.add(arr.get(i));
arr.get(i).add(arr.get(j));
i++;
j--;
}
}
if (low < j)
quickSort(arr, low, j, pers);
if (high > i)
quickSort(arr, i, high, pers);
}
This part of the function is giving me errors:
if (i <= j) {
Vector<Personne> temp = new Vector<Personne>();
temp.add(arr.get(i));
arr.get(i).add(arr.get(j));
i++;
j--;
}
I tried .get()
,.elementAt()
,creating a new temp vectors that will hold the information but I just can't seem to fix it.
error
C:\Users\Arnold\Desktop\numero3.java:241: error: cannot find symbol arr.get(i).add(arr.get(j)); ^ symbol: method add(Personne) location: class Personne 1 error