We hope the last video very well explained you what are the prime numbers and how you can find whether a number is prime or not in O(n) time complexity. In this video , we have discussed two approaches that are better than the naive approach discussed in last video.
First approach is to determine whether a number is prime or not in O(n/2) time complexity.
The second approach determines whether a number is prime or not in root N time complexity.
Root N approach is based on the fact that we will definitely find a prime factor of N below (sqrt(N)).
Stay tuned for more interesting problems around prime numbers.
Learn coding from experts through PrepBytes Personalised coding courses :

0 Comments