Комментарии:
What about the time that is taken by Shyam to compute the square root of n? Should not we include that as well while computing the time complexity?
ОтветитьRam and Shyam are the Most used names of to people use as an example in India form class 1st to highest level of education 😂😂😂
ОтветитьRest In Peace Brother. Really sad to know world lost you.
Ответитьi know prime numbers..but watching this gives me confidence..:-D
ОтветитьThanks U Sir
Ответитьu r too good sir
ОтветитьWhy this video is getting blur, anyone facing the same issue.!?
Ответить@mycodeschool is the eureka moment for me. Every video is so simple and gives a great refresher/addon in computer science fundamentals.
ОтветитьYou're amazing !!!
Greetings from Brazil ! <3
Codechef
ОтветитьPeople may come and go but this video shall go on forever
ОтветитьShyam 1 , Ram 0
Ответитьits good
ОтветитьThis man surely does not know the difference between yellow and orange color
ОтветитьAnyone from 2020 when corona virus is a threat to humankind
Ответитьhow it is n-2 times and other is n-1
ОтветитьWhenever i need to recall DS and Algo concept i definitely come here. best of best. May his soul rest in peace. I request to other cofounder please take some time and made videos on oop so beginner like me clear their concept plz plz
ОтветитьMy laptop will probably gonna crash if I inputted n = 1000003. lmao
Ответитьmore time saving trick....
1. If square root of n is a decimal then the number is prime.
2. No need to run the loop is first logic is used.
(Edit) 3. Only in case u need list of all prime numbers below n then run the loop.
All of these started here, but he left us already :(
ОтветитьHow come I didn't see this video and this channel sooner....You are really something else, Animesh! Thank you!
ОтветитьMy name is shyam 😁😁😁
ОтветитьMy man.
Ответитьill be really honest...This video literally enlightened me...dude youre just a great teacher
Ответитьwatching in 2021 :)
ОтветитьShall I watch this video it was uploaded 8 years ago?
I am new to programming
Please please any one reply me.
I like this channel a lot since I came to know about it in UG. I expected more videos since then from this channel but today I came to know why they were not coming.
I am deeply saddened by demise of Harsha RIP🙏🏻.
I didn't understand how loop will run n-2 times in Ram ALgo. and sqrt(n-1) times in Shyam Algo in worst case. plz explain
Ответить;)
ОтветитьYou guys are great man...
Ответитьamazing
ОтветитьVery helpful video
thanx bro
am i Late?
ОтветитьSham rox Ram shox
ОтветитьWOW
ОтветитьMiss you sir !
Ответитьwatching this on Sep 11, 2022! Thanks for great content. :)
Ответитьplzz upload more videos
ОтветитьN is a letter
ОтветитьGreat explanation!
ОтветитьTime Complexity
Prime number is a number that can divided by exactly two numbers
1 and the number itself
smallest prime number is 2
number-prime ?
2
3
5
7
is_prime function
Ram
for (int i = 0; i < input_number; i++) {
if (input_number % i == 0) {
return false;
}
}
return true;
Shyam
for (int i = 2; i <= sqrt(input_number); i++) {
if (input_number % i == 0) {
return false;
}
}
return true;
- lets say 1 ms for a division operation
- Rams program: in worst case performs (input_number - 2) divisions
- Shyam program: in worst case performs (sqrt(input_number) - 1) divisions
------------------------------------------------------------------------
Time to run the program with different inputs
------------------------------------------------------------------------
input_number = 11
Ram program: (11 - 2) = 9 ms
Shaym program: (3 - 1) = 2 ms
------------------------------
input_number = 101
Ram program: (101 - 2) = 99 ms
Shaym program: (10 - 1) = 9 ms
------------------------------
input_number = 1 000 003
= 10⁶ + 3
Ram program: (1 000 003 - 2) ≈ 10⁶ = 10³ seconds
= 16.66 minutes
Shaym program: (sqrt(10⁶ + 3) - 1) ≈ 10³ ms = 1 second
------------------------------
Time complexity of a program is the simple measurement of how fast
the time taken by the program grows if the input size increases
Ram program:
Time ∝ input_number O(input_number)
The time taken by the program is proportional to the input_number
Shaym program:
Time ∝ sqrt(input_number) O(sqrt(input_number))
The time taken by the program is proportional to the square root of the input_number
Sieve of Eratosthenes prime numbers is least execution i think
Ответитьsuch a great explaination
ОтветитьI dont how the lecture was passed away but may your soul rest in peace sir 🙏
Ответитьwhy n-2 times while sqrt(n-1) times???
Ответитьwhy must a grief for a man i have never met
ОтветитьRam what a loser!!!!!!
ОтветитьI am here in 2025, and I can bet if there are any better videos of Big 0 notation than this.
Ответить