Table of Contents
▶
- Working of Breadth First Search in Hindi
- Algorithm for Breadth First Search in Hindi
- Advantages of Breadth First Search in Hindi
- Disadvantages of Breadth First Search in Hindi
- Applications of Breadth First Search in Hindi
Working of Breadth First Search in Hindi
Breadth First Search (BFS) एक graph traversal algorithm है, जिसमें हम किसी graph या tree के सभी nodes को level by level (एक-एक स्तर में) visit करते हैं। इसमें सबसे पहले starting node को visit किया जाता है, फिर उसके सभी पास वाले nodes (neighbors), फिर उनके neighbors और इसी तरह आगे बढ़ते हैं।
BFS में Queue (FIFO) data structure का उपयोग होता है। जो node पहले आता है, उसे पहले process किया जाता है। इससे हम graph को चौड़ाई (breadth) में explore करते हैं।
Algorithm for Breadth First Search in Hindi
Steps:
- Step 1: Starting node को queue में डालो और उसे visited mark करो
- Step 2: Queue से एक node निकालो
- Step 3: उस node के सभी unvisited neighbors को queue में डालो
- Step 4: उन neighbors को visited mark करो
- Step 5: जब तक queue खाली न हो जाए, process दोहराते रहो
Advantages of Breadth First Search in Hindi
- Shortest path आसानी से ढूंढ सकता है (unweighted graph में)
- Simple और समझने में आसान algorithm है
- Level wise traversal के लिए best है
Disadvantages of Breadth First Search in Hindi
- Memory ज्यादा use करता है (queue की वजह से)
- Large graph में slow हो सकता है
- हर node को store करना पड़ता है
Applications of Breadth First Search in Hindi
- Shortest path find करने में
- Social network analysis (friends connection)
- Web crawling और search engines में
- GPS navigation systems में