Find the cost function of the following algorithm and express the upper bound of the time complexity in asymptotic notation. (10 marks)

bool IsPrime(int n) // Check whether n is a prime number
{
int i = 3;
if (n == 2 || n == 3)
return true;
if (n % 2 == 0)
return false;
while (i * i < n)
{
if (n % i == 0)
return false;
else
i = i + 2;
}
return true;
}