No video

Graph Data Structure | Part 6 | Breadth First Search and Traversal | BFS

  Рет қаралды 1,495

Nikhil Lohia

Nikhil Lohia

Күн бұрын

Chapters:
00:00 - Intro
01:10 - BFS vs DFS Visually
08:00 - Breadth First Traversal
13:05 - Code (Iterative BFS)
15:45 - Applications & Examples
19:31 - Final Thoughts
📚 Links to topics I talk about in the video:
Adjacency Matrix: • Graph Data Structure |...
Adjacency List: • Graph Data Structure |...
Queue Data Structure: • Queue Data Structure e...
Depth First Search: • Graph Data Structure |...
Graphs Introduction: • Graph Data Structure |...
Complete playlist: • Graphs
📘 A text based explanation is available at: studyalgorithms.com
Code on Github: github.com/nikoo28/java-solut...
📖 Reference Books:
Starting Learn to Code: amzn.to/3sJm8Wl
Favorite book to understand algorithms: amzn.to/4848xJH
Favorite book for data structures: amzn.to/3P96YBv
Get started for interview preparation: amzn.to/44Nn5du
🔗 To see more videos like this, you can show your support on: www.buymeacoffee.com/studyalg...
🎥 My Recording Gear:
Recording Light: amzn.to/3PdsViT
Microphone: amzn.to/3Exv83x
Recording Camera: amzn.to/3PwyN8e
Tablet to sketch and draw: amzn.to/3ZdKVy7
Sketching Tool: amzn.to/45XJEgY
Laptop to edit videos: amzn.to/460ofDu
💻 Get Social 💻
Follow on Facebook at: / studyalgos
Subscribe to RSS feeds: studyalgorithms.com/feed/
Join fan mail: eepurl.com/g9Dadv
#graphs #datastructures #interview

Пікірлер: 17
@introvertwhiz-ll2ip
@introvertwhiz-ll2ip 2 ай бұрын
You are a blessing in the world of programming sir.
@viveksundli
@viveksundli 7 ай бұрын
simple sketches, clean code, Awesome explantion.. pls dont stop!
@jaydeepvasoya6243
@jaydeepvasoya6243 6 ай бұрын
keep it up Bro... Doing well Job... Thank you
@tanishkaagarwal6750
@tanishkaagarwal6750 4 ай бұрын
Thank you sir for the wonderful explanation
@jjoelthomas
@jjoelthomas 7 ай бұрын
Wonderful explanation🥰
@unemployedcse3514
@unemployedcse3514 2 ай бұрын
awesome ❤
@vipulaggarwal8518
@vipulaggarwal8518 13 күн бұрын
the map in the video give us the idea that you are living in New York . I was thinking that you are living in India😄. Bye the way, the explaination is so clear and understandable to me.
@nikoo28
@nikoo28 13 күн бұрын
that is just a random google image.. 😄
@lo_sten
@lo_sten 3 сағат бұрын
Why do you visited.add in the IF statement since you haven't visited the node yet, and at this point you are just checking for neighbors?
@shenth27
@shenth27 4 ай бұрын
I think it'd make a bit more clearer if you add to the visited nodes once pulled from the queue.
@rohitnandan5454
@rohitnandan5454 Ай бұрын
Yes, I also got confused at this point in the code. Better to be consistent across DFS and BFS if its just a matter of replacing stack with Queue.
@skyline2203
@skyline2203 5 ай бұрын
I was wondering in your explanation of the BFS you add a node to the visited Set only once it's popped from the Queue which makes sense intuitively similar to DFS. However in your code explanation you mark a node as visited one line after its being added to the queue. Can you explain this and does it make a difference? Which is correct? Thanks for your comprehensive videos
@nikoo28
@nikoo28 4 ай бұрын
does not make a difference...it is just for explanation
@unique_ruler_memes3003
@unique_ruler_memes3003 3 ай бұрын
One question or Doubt:: You were not checking whether popped element from the queue is visited or not in the code.. without tis check you were printing ..SO there is a possibility of getting a node printed more than one time likewise in the case of example you explained before code..
@nikoo28
@nikoo28 3 ай бұрын
The way BFS works ensures that you are not encountering the same node twice. Sure, there can be two nodes in the graph that have same value. They will print twice, but they are different nodes, hence valid
@InfiniteRedditEpisodes
@InfiniteRedditEpisodes Ай бұрын
I'm confused, Why do we mark a node as visited as soon as we add it into the queue as oppose to while we are actually polling it in the code? in DFS we only marked a node as visited when we popped it from the stack.
@nikoo28
@nikoo28 Ай бұрын
you can mark it visited anytime. Watch my video on DFS, i mark it visited as soon as I add it
لقد سرقت حلوى القطن بشكل خفي لأصنع مصاصة🤫😎
00:33
Cool Tool SHORTS Arabic
Рет қаралды 29 МЛН
SPILLED CHOCKY MILK PRANK ON BROTHER 😂 #shorts
00:12
Savage Vlogs
Рет қаралды 20 МЛН
Sigma girl and soap bubbles by Secret Vlog
00:37
Secret Vlog
Рет қаралды 15 МЛН
Graph Data Structure | Part 1 | Animations and Visuals
17:48
Nikhil Lohia
Рет қаралды 3,9 М.
لقد سرقت حلوى القطن بشكل خفي لأصنع مصاصة🤫😎
00:33
Cool Tool SHORTS Arabic
Рет қаралды 29 МЛН