I am trying to find the time complexity of the following algorithm that finds the prime numbers given the vector. Specifically I am not sure about the last for loop with another loop nested in it. I think it's O(sqrt(n)/2), and then the loop inside it is O(n)?
void PrimeFind (std::vector<bool> &vec)
{
int vsize = vec.size();
size_t sqvsize = ceil(sqrt(vsize));
std::fill(vec.begin(), vec.end(), true);
vec[0] = false;
vec[1] = false;
for (int i = 4; i < vsize; i += 2)
{
vec[i] = false;
}
for (int i = 3; i < sqrtvsize; i += 2)
{
if (vec[i])
{
for (int j = i * i; j < vsize; j += i)
{
vec[j] = false;
}
}
}
}