ไม่สามารถเล่นวิดีโอนี้
ขออภัยในความไม่สะดวก
Program To Find All The Prime Factors Of A Number | FREE DSA Course in JAVA | Lecture 13
ฝัง
- เผยแพร่เมื่อ 19 ส.ค. 2024
- Data Structures and Algorithms Free Course (Learn DSA Without Paise) Playlist - • Data Structures And Al...
We are up with the lecture 13 of our much awaited dsa course in java.
This is the last lectured of the mathematics module of our data structures and algorithms course in Java.
In this lecture we will learn the logic to find all the prime factors of a given number.
And ultimately the code and program to find the prime factors of a given number.
Check out the complete lecture to know more.
Subscribe to our channel for regular updates on the dsa course and click on the bell icon to never miss an update from our dsa course.
For more information, fill this form: forms.gle/8eiU...
or call us at 8884881203
Facebook: / thetapacademy
Instagram: / tapacademy_online
Linkedin: / 73820805
Website: www.thetapacad...
#dsa #dsacourse #java #dsainjava #javaprogramming #coding #coder
Why is this channel underrated? sir teaches so best. Anything he teaches goes straight to my mind and that’s just because sir’s clarity in explaining. Thanks sir!!!!❤❤❤❤
thanx a lot sir it helped me a lot
gajab padate ho sir , 1 number
Excellent explanation. Appreciate your efforts.
There is another approach, similar to the second approach but it has time complexity of O(root(n)). Following is the code:
int i =2;
int root = (int) Math.sqrt(n);
while(i1){
System.out.println(n);
}
This works same as the second code the only difference is we are using if else instead of nested while loops which helps in further decreasing the time complexity from O(root(n)logn) to O(root(n)).
🤙🤙💥💥💫 good Explanation sir.
lectures
I'm here just to see the algorithm. I liked how you started with a simple algorithm and then you optimized the algorithm. Well explained. Thank you. Only other optimization that I can see, is maybe only check n with odd numbers after n has been checked with 2.
what a explation sir
Sir I am very helpful for god-tier explanation. I am hoping to learn DSA completely through your videos and going to share your channel to all of my friends.
So nice of you. Do recommend Tap Academy in your community. It will be great if you can share our channel in your whatsapp groups amongst your friends.
It never work for few numbers. Ex: 91
Never work for multiples of any 2 prime numbers like 6, 14, 15, 21 etc
then why it does not includes 1 when you type 19 , it should be (19 , 1)no ?
1 is not a prime number.
If u still want 1 then u can just add a if condition.
if(n>1) then print 1.
It gives output as 13 for input 130. i value does not exceed the square root of 130 i.e.11.4 ~ 11 & last prime factor is 13. Kindly check . Better to keep time complexity as NlogN & revert to previous condition of while(n>1)
Kindly recheck your code for input 130,output will be 2,5,13
130 is not a prime number . It's a composite number. As per program in first while condition we are checking i square less than or equals to n not i less than or equals to root of n.so it works fine.