Detect & Remove Cycle in a Linked List | Floyd's Cycle Detection Algorithm | DSA-One Course #39
Вставка
- Опубліковано 11 жов 2024
- Hey guys, In this video, We're going to learn Floyd's cycle Detection Algorithm. This algorithm is used to detect and remove cycle in a Linked List.
Code: www.geeksforge...
🥳 Join our Telegram Community:
Telegram channel: telegram.me/re...
Telegram group: telegram.me/ds...
🚀 Follow me on:
Instagram: / anuj.kumar.sharma
Linkedin: / sharma-kumar-anuj
Twitter: / realanujbhaiya
💸 Use coupon code ANUJBHAIYA on GeeksforGeeks to avail discounts on courses!
📚 Complete DSA Playlist: • DSA-One Course - The C...
Complete Android Development Playlist: • Android Development Tu...
Hashtags:
#anujbhaiya #dsaone
Ignore these tags:
detect
detect lying
detect lyin
dust detect
detect lies
detect movie
detect tempo
detect fakes
detect liars
dyson v15 detect
detect short film
detect short movie
how to detect liars
dewalt power detect
dyson v12 detect slim
how to detect baloney
how to detect deception
detect independent film
detect telugu short film
how to detect dark matter
dyson v15 detect inceleme
detect the honest officer
how to detect counterfeit
linked list
linked list in c
linked list conept
linked lists
linked list in hindi
linked list in python
linked list examples
linked list in c programming
c programming for beginners
beginners
c tutorial for beginners
stock market for beginners
sql for beginners
beginner
beginner chinese
it beginner course
beginner in coding
apis for beginners
investing for beginners
beginner sewing tips
sql beginners
beginner ds algo
c programming for begineers
I really like those who taught concepts in Hindi. Becz being an Indian jitne clarity Hindi me aate hai utne English me kabhi nahi aate. English me sirf concept samagh aata hai or Hindi me concept ghus jaata hai.. Thanks for making such a good content.
Your dry run technique is the best bro.
Aisi explaination with proof mai pahli baar dekh raha hun
Thank you very much bhaiya
Sukriya bhai 😍 itna regular ho kr toh padh b nahi paate jitna regularly videos aa rhe h, Tx for ur time bhai.
just wow! thank you very much for making DSA easy comfortable and lovable!
Very Nice Explanation,
For removing the loop, we can put a condition in the while loop without maintaining another pointer
while(start->next != meet->next)
{
start = start->next;
meet=meet->next;
}
meet->next = NULL;
This is should remove the loop
Please add more interview questions cover all dsa topics as fast as possible..I am following from ur course java for placements .I am unable to find This type of teaching . Please add more videos fast my placements are running in my clg🙏🙏..and thanks so much for ur contribution ❤️❤️
Exactly this series is one of the best on youtube
Best explaination on the youtube...Thank you bhaiyaaaaaa
this dsa-algo course is really helpful , if possible create more videos like this to solve the classical question of dsa
Thanks Anuj Bhaiya,For Making DSA Easy to Learn
Thank You Anuj Bhaiya, now I am clear with Floyd's Cycle Detection Algorithm. :)
Thank u Anuj Bhaiya
Best explanation ever got for this problem
Best explanation for this question
Thank you. You have done a great job explaining this. Many other videos I saw (mostly in English) does not do a good job of explaining why the start of the cycle node will be the meeting point after the slow pointer is reset back to start of the list.
bhaiya kya tagda dry run krke smjhaya hai mja hi aagya
Crystal Clear Explaination!
Thank you so much...
Thank you so much It was so helpful...
Just keep going 👍
Thank you very much brother, I am in lot of confusion with this "linked list cycle check". Your video helped me to understand in a better way and the way of teaching is simply amazzzzzzing.
yes, it is very helpful sir..
Best Video in UA-cam till date.
thank you so much sir i was struggling to understand the second proof but you made it clear. ❤
It was simply awesome and crystal clear..
Thanks sir, the proof was the simplest explaination ever!
Thank you Sir💕❤️❤️💕
Bhaiya ye course complete kerna bht acha course h very useful h or thoda jaldi jaldi videos dalo awesome course h ♥️♥️♥️
YES,IT WAS HELPFUL TQ Anuj Bhaiya
Next level 💯 👌 bhai (bro) , I just love the way how you proved that. Literally great 👍 explanation 👏
Tagda explanation bhaiya ji
Bs isi trh aur saare problems ki vdo daalte rho
awesome explanation bhaiya 😀
Just give an additional if statement to handle the null pointer error in the detectCycle function.
Easy to understand..very nice I am following all ur lectures...!!!
thx bhaiya ur great and here is my solution to remove cycle :-
public static void removeCycle(Node node, Node head) {
LinkedList_copied list = new LinkedList_copied();
if(node == null || node.next == null) {
return;
}
Node curr = head;
Node ptr = node;
Node prev = null;
while(curr != ptr) {
prev = ptr;
ptr = ptr.next;
curr = curr.next;
}
prev.next = null;
}
Amazing and Best explanation
Sir I don't think ki slow wala pointer ek se zyda cycle lagyega.... kyu ki jab wo cycle ki starting point pr reach krega us time "fast pointer" to "slow pointer" ke beech ka gap N step hoga, and N
Thanks ❤️
👍 YES, IT WAS HELPFUL. THANKYOU SO MUCH FOR SHARING YOUR KNOWLEDGE WITH US. 🙏🙏🔥🔥🔥
YES, IT WAS HELPFUL. THANKYOU SO MUCH FOR SHARING YOUR KNOWLEDGE WITH US.
Maja aa gaya bhai, best video on linkedlist
Jod! explanation
your explain's skill really good , i got this linked list problem .Thanks keep contniue.
Yes, very helpful
So helpful🤗 Thank you❤️
Yes
The idea was helpful!
Wonderful explanation bahiya
Nice explanation Anuj Bhaiyan ji
Thank you sir your teaching method is amazing its really helpful to understand the concept of
dsa
wonderful explanation
Bahut se bhi uppppar helpful
Really helping video bhiya...keep uploading...placement season is going on . (tier 3 cllg )😅
What a mind blowing and easy explanation
Great 😃 explanation thank you 😊
The equation should be
A + B = (n-2m) * (B+C)
instead of
A + B = (n-m) * (B+C)
You're right @Rohitislampur
Yes it was helpful
Big Yes! Apne naya sekha diya
Veryy much helpful bro...thank you 🙇🙇
Yes, It was very very helpful
Yes it was helpful. Thank you.
Yes video was helpful 😃
Bhaiyaa please upload more project bases learning videos on android development playlist. Earlier 5 projects were awesome.
yes it is very very very helpful..plz make video on some more question
YES, IT WAS HELPFUL
Simple and best explanation !
Aww thanks bhaiya ji (sir)♥️🙏🏻
Yes
bhot bdiya mzaa aagya bhaiya
I saw your first video and you got a subscriber....
class Solution
{
//Function to remove a loop in the linked list.
public static void removeLoop(Node head){
// code here
// remove the loop without losing any nodes
Node slow,fast;
slow=fast=head;
while(fast!=null && fast.next!=null){
fast=fast.next.next;
slow=slow.next;
if(slow==fast){
break;
}
}
if(fast==null || fast.next==null) return;
if(slow==head){ // If the intersection is in the 1st node itself
while(slow.next!=head){
slow=slow.next;
}
slow.next=null;
return;
}
Node curr=head,prev=slow;
while(slow!=curr){
prev=slow;
slow=slow.next;
curr=curr.next;
}
prev.next=null;
}
}
This is the actual code for those who needs it!
Very helpful
yes, it was helpful. Great Explanation
bhaiya yaar matlab maza hi aa gya
It was veryyyyyyy helpful❤❤✨ ye course jaldi jaldi complete kra dijiye bhaiya!🙂
please
Ek Number Bhai
Yes, helpful video ❤❤
extremely helpful. thanks.
Clear-cut explanation😃
Best!!
Great explaination
gazab bhaiya gazab 🔥🔥🔥.
!!!!!!!!!!!
YES
Great explanation ❤
Hi Anuj, this was an excellent explanation. Just a suggestion that you can take the refrence from relative velocity to even simpler. Also you can say that 2*speed_slow = speed_fast for given time resulting the distance equation for same time.
Also, thank you again for this great explanation. Really appreciate your efforts and hard work
Yes, It was helpful.
very helpful.. thank u bhaiya
it is helpfull bhaiya
bhaiya please also cover EDGE CASES , remove loop krne vale program mai aapne edge case cover nahi kra jiske bina code bekaar h
nice explanation
Crystal clear
Thank you brother!
it was very helpful bhaiyaa!
yes
Yes it was helpful sir
best explainnation
Thank you
Yes very helpful
nice explanation.
It was really very helpful thanks 👍
thank you bhaiya❤❤
Yes Very Helpful
Yes it was helpful 😇
lovely proof