Welcome to Westonci.ca, the Q&A platform where your questions are met with detailed answers from experienced experts. Get quick and reliable solutions to your questions from a community of experienced experts on our platform. Get detailed and accurate answers to your questions from a dedicated community of experts on our Q&A platform.
Calculate the time complexity for the following function in terms of Big O notation. Explain your answer.
[Note: Line numbers are only for reference purpose]
int fun(int n)
{
1 int count = 0;
2 for (int i = n; i >= 0; i /= 2)
3 count += i;
4 for (int j = 0; j < n; j++)
5 count +=j;
6 return count;
}
