Program to find whether a number is prime or not - O(n/2) and O(sqrt(n)) Approach
Автор: PrepBytes
Загружено: 2019-09-15
Просмотров: 19403
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 : http://bit.ly/2kO3rhN
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: