Middle of a Linked List (LeetCode 876) | Full Solution with animations | Study Algorithms

preview_player
Показать описание
Given any type of a list, finding the mid point feels very natural and fundamental. Determining the middle point of a linked list can be a bit tricky as we only have access to the head node. Watch this video to understand how we can use the hare and tortoise algorithm to find the middle of a linked list efficiently. All along with animations and a dry-run of code in JAVA.

Chapters:
00:00 - Intro
- Problem Statement and test-cases
- Straight forward approach
- Hare and tortoise algorithm
- Dry-run of Code
- Final Thoughts

📚 Links to topics I talk about in the video:
Array Data Structure:
Linked Lists:
Traversing a Linked List:

📖 Reference Books:

🎥 My Recording Gear:

💻 Get Social 💻

#leetcode #programming #interview
Рекомендации по теме
Комментарии
Автор

The way of explaining is
infinite likes

jokergotham
Автор

Explanation is gold! Thank you my good sir!

safar
Автор

The way you explain is mind blowing. Keep posting such videos!! Thanks a lot

anushka
Автор

nice explanation sir i understood now slow and fast pointer method .
Thank you🙂

singhshek
Автор

Thank you so much for this explanation and I understood it perfectly

oluwatosin
Автор

very good explanation and thought. thank you sir

samsulalam
Автор

sir what if the length of LL is bigger?

yt_goluyadav
Автор

while loop looks incorrect as you are saying "or" condition but programmed "and" condition. But, I checked further and confused about why does the program fail when worked with "or " condition?

avanishraj
Автор

Can we use (slowPtr != null) with remaining conditions in while loop I think this will also work
May I know why you are not adding (slowPtr != null) in while condition.

kalyanamvenumadhav