`
`#include <bits/stdc++.h>
using namespace std;
int partition(vector<int>& vec, int low, int high) {
int i = low - 1;
int j = high + 1;
int pivot = vec[high];
while (1) {
do {
i++;
} while (vec[i] < pivot);
do {
j--;
} while (vec[j] > pivot);
if (i < j) {
swap(vec[i], vec[j]);
}
else {
return j;
}
}
}
void quicksort(vector<int>& vec, int low, int high) {
if (low >= high) {
return;
}
int p = partition(vec, low, high);
quicksort(vec, low, p);
quicksort(vec, p + 1, high);
}
int main() {
int n, low, high;
cout << "xin hay nhap do lon cua day: ";
cin >> n;
vector<int>vec(n);
for (int i = 0; i < n; ++i) {
cin >> vec[i];
}
quicksort(vec, 0, n - 1);
for (int i = 0; i < n; ++i) {
cout << vec[i] <<",";
}
return 0;
}`
I went through all the codes but can’t find anything that was wrong, but my code didn’t work. can you help me with this :DD . It also said something about vector, i couldn’t find any problems about it, not that i know of.