Question: 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)

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 or n==3 then return true; if( n%2 ==0) return false; while (i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
