Prim’s Algorithm In Hindi In Data Structure.

हेलो Friends , आज के इस blog post(Prim’s Algorithm In Hindi) में मैं आपको एक बहुत ही important algorithm के बारे में बताने जा रहा हूँ|

जिसका नाम है Prim’s algorithm(Prim’s Algorithm In Hindi), आपने इस Prim’s algorithm को data structure में पढ़ा होगा |

और जिन लोगो ने नहीं भी पढ़ा है वो चिंता न करे मैं Prim’s algorithm को यहाँ पर बहुत ही simple तरीके से explain करने वाला हूँ|Prim’s Algorithm In Hindi|

Prim’s algorithm(Prim’s Algorithm In Hindi), greedy algorithm का एक type है or आप कह सकते है कि यह एक greedy algorithm ही है|

जिसके तहत हम दिए गए problem से सबसे optimal और closest solution को find करने की कोशिश करते है |Prim’s Algorithm In Hindi |

कहने का मतलब यह है की अगर हमें एक graph दिया जाता है और बोला जाता है की इस ग्राफ का spanning tree बनाओ वो भी Prim’s algorithm की मदद से|

तब इस केस में हम Prim’s algorithm की मदद से spanning tree का निर्माण करते है |

Prim’s algorithm को step by step समझने के लिए निचे दिए procedure को ध्यान से देखे / What is Prim’s algorithm with example?

prim's algorithm procedure
prim’s algorithm In Hindi procedure

ऊपर दिए हुए चित्र में सबसे पहले हमें एक undirected graph दिया गया है, जिसका हमें spanning tree बनाना है |

Fig (a) में हम सबसे पहले सभी vertex बना लेते है जैसे के मैं ग्राफ में दिए गए है और इसके बाद हम ग्राफ में देखते है की कौन सी edge सबसे छोटी है|

यहाँ पर हम देख सकते है की edge DE और GH दोनों की length ही 2 है जो कि सबसे छोटी लेंथ है |

पर यहाँ पर हम कोई भी एक edge ले सकते है, orderwise सबसे पहले हम DE को लेते है, क्योकि यहाँ पर हमारा स्टार्टिंग vertex D है |

DE के बाद हम देखते है कि इसके nearest vertex कौन कौन से है जिनकी cost minimum है |

तो हम यहाँ पर देखते है कि DA कि cost सबसे minimum है जो कि 3 है, इस तरह हम D से A को ज्वाइन कर देते है |

इसके बाद हम देखते है कि A D और E के nearest vertex में सबसे कम cost किसकी है, तो हम यहाँ पर पाते है कि सबसे कम cost EG कि है, इसलिए हम EG को ज्वाइन कर देते है|

इसके बाद हम देखते है कि A , D, G E के नजदीक सबसे कम cost वाला vertex कौन सा है, तो हम यहाँ पर देखते है कि सबसे कम cost GH का है जो कि 2 है |

फिर से वही प्रोसेस दोहराते है और देखते है कि A , D, G , E, और H के नजदीक सबसे कम cost वाला vertex कौन सा है|

यहाँ पर हम देखते है कि सबसे कम cost वाला vertex है B, इसलिए हम HB को join कर देतें है |

फिर से इसी तरह हम देखते है कि A , D G E H B के नजदीक सबसे कम cost वाला vertex कौन सा है|

और यहाँ पर हम पातें है कि सबसे कम cost वाला vertex है F, हम FH को ज्वाइन कर देते है |

same इसी तरह अगला vertex होता है C, इसलिए हम FC को ज्वाइन कर देते है |

इसके बाद हम जब किसी भी कम cost वाले vertex को देखते है, और उस vertex को ज्वाइन करते है…

… तो एक loop बनने लगता है or एक cycle बनने लगती है इसलिए हम प्रोसेस को यहीं पर रोक देते है |

इस तरह हमें हमारा spanning tree मिल जाता है |

इस Prim’s algorithm(Prim’s Algorithm In Hindi) में याद करने लायक एक बात यह होती है|

कि यहाँ पर जो हम spanning tree बनाते है वो हमेसा connected रहता है और यहाँ पर node connected रहते है|

कहने का मतलब यह है कि हमारे node से connected जितने node होतें है हमें उसी में से minimum cost देखना होती है |

यहाँ पर आपके दिमाग में एक question आ सकता है कि अगर 2 बराबर cost वाली एज है तो सबसे पहले कौन सी edge लेनी है?

वैसे यहाँ पर हमने edges को एक order में लिए है, पर आप कोई भी edge सेलेक्ट कर सकते है|

इससे आपका spanning tree थोड़ा different होगा पर होगा वो भी एक spanning tree |

वैसे भी हम एक complete undirected ग्राफ से बहुत सारे spanning tree बना सकते है |

अगर हमारे ग्राफ में ३ वर्टेक्स है तो हम उससे ंपोन-२ स्पॅनिंग ट्री बना सकते है |


Kruskal Algorithm In Hindi In Data Structure. Kruskal Algorithm हिंदी में/ What is Kruskal’s algorithm used for?

Please go through the below extensive blog link related to Data Structure:

Sorting Algorithm And Their Time Complexity In Data Structure.
What is meant by the Shell sort in data structure?
Radix Sort In Data Structure / What is the Radix sort used for?
What is a quick sort of data structure?/ How do you write a quick sort?
Selection Sort In Hindi In Data Structure/ How do you perform a selection sort? / Selection sort kya hai?
Bubble Sort In Hindi In Data Structure/ What is bubble sort for example?/ Bubble Sort Kya Hai?
Insertion Sort In Hindi/ insertion sort step by step/ Insertion sort kya hai?
Searching In Data Structure/ What is the searching in data structure?
Shell Sort In Data Structure In Hindi?
Quick Sort In Data Structure In Hindi?
Types Of Data Structure In Hindi…
Tower Of Hanoi In Data Structure In Hindi…
Circular Linked List In Hindi…
Linked list in Hindi…
Data Structure In Hindi…
Dijkstra Shortest Path Algorithm In Hindi…
Heap In Data Structure In Hindi…
Check if a given Binary Tree is a Heap…
B-Tree Example In Data Structure…
Kruskal Algorithm In Hindi In Data Structure…
Prim’s Algorithm In Hindi In Data Structure…
Difference Between Tree And Binary Tree In Hindi…
STACK In Hindi/ STACK Kya Hota Hai…

Quick Q&A:

What is Prim’s algorithm with example? Prim ‘s algorithm क्या है, example देकर के समझाइये?

Prim ‘s algorithm जो है वो एक greedy algorithm है|

और इसका उपयोग किसी भी एक नेटवर्क के लिए minimum spanning ट्री find करने के लिए किया जाता है|

इस algorithm में प्रत्येक नोड को एक साथ कनेक्ट किया जाता है |

इसके लिए नोड्स के बीच छोटे से छोटा edge डिस्टेंस पता किया जाता है और उन्हें साथ में जोड़ा जाता है|

What is Prim’s algorithm easy explanation? Prim ‘s algorithm को आसान शब्दों में समझाइये?

देखिये Prim’s algorithm के अंतर्गत हम एक arbitrary vertex से चलना स्टार्ट करते है |

और फिर जिस edge का weight कम होता है उसे हम जोड़ते चले जाते है |

और यही process हम रिपीट करते जाते है जब तक कि सभी vertex कवर न हो जाये|

What is Prim’s and Krushkal’s algorithm? Prim ‘s और Kruskal algorithm को समझाइये?

Prim ‘s algorithm में हम root vertex को सेलेक्ट करते है और फिर छोटे edge weight के आधार…

… पर adjacent vertex to vertex traverse करना चालू कर देते है|

वही दूसरी तरफ Krushkal algorithm जो है वो हमें minimum spanning tree generate करने में मदद करती है|

जो कि सबसे छोटे edge weight से चालू होता है|

Is Dijkstra’s algorithm greedy? क्या Dijkstra ‘s algorithm एक greedy algorithm है ?

हाँ, यह एक greedy algorithm है|

इस algorithm का उपयोग हम दो vertex के बीच shortest distance find करने के लिए करते है|

यह एक डायनामिक प्रोग्रामिंग algorithm है|

What is the output of Prim’s algorithm? Prim ‘s algorithm का output क्या निकलता है?

देखिये Prim ‘s algorithm इनपुट में weighted , undirected , connected graph को लेती है |

और return में यह एक MST ग्राफ को आउटपुट के तौर पर देती है|

यह अल्गोरिथम greedy manner में काम करती है| इसके पहले स्टेप में एक arbitrary vertex को select किया जाता है |

और इसके बाद इसके सबसे पास वाले vertex को add किया जाता है |

और यह process जब तक चलती है जब तक कोई भी vertex disconnected न रह जाये|

Why use a minimum spanning tree? Minimum spanning tree का उपयोग क्यों करते है?

Minimum spanning tree का उपयोग हम map के अंदर सरल रास्ता ढूंढ़ने के लिए करते है |

और इसका उपयोग हम network को design करने के लिए भी करते है |

जैसे कि example के लिए water supply नेटवर्क और इलेक्ट्रिकल ग्रिड नेटवर्क्स, etc |

What are the 3 applications of minimum-spanning trees? Minimum spanning trees के 3 मुख्य applications क्या है?

Minimum spanning trees के तीन applications निम्नलिखित है:

एक तो सीधा सीधा network को desing करने में|

जैसे कि कंप्यूटर नेटवर्क, टेलेकम्युनिकशन्स नेटवर्क्स, ट्रान्सपोर्टेशनस नेटवर्क्स, वाटर सप्लाई नेटवर्क्स, इलेक्ट्रिकल ग्रिड नेटवर्क|

What is an example of a spanning tree in real life? रियल लाइफ में spanning tree को example दे कर समझाइये?

Telecommunication कंपनी के द्वारा एक नयी जगह पड़ोस में केबल को बिछाना|

अगर यहाँ पर cable बिछाने के लिए एक constrained हो कि आपको cable केवल रोड के साइड साइड से बिछानी है |

तो फिर इसके लिए एक ग्राफ जरूर होगा जो यह रिप्रेजेंट करेगा कि उन paths के द्वारा कौन कौन से पॉइंट्स connected है|

What is the efficiency of Prim’s algorithm? prim’s algorithm की efficiency क्या होती है?

इस मेथड में, prim ‘s algorithm की best , worst , और average case टाइम complexity होती है O(E + logV)

Is Prim’s algorithm the shortest path? क्या prim ‘s algorithm एक shortest path algorithm है?

Prim’s algorithm जो है वो Dijkstra ‘s algorithm की तरह ही है जिसका उपयोग हम shortest path ढूंढ़ने के लिए करते है|

इस प्रोसेस में हम उस vertex से जो already ट्री में marked हो गया है से उसके adjacent vertex को ढूंढ़ते है जो कि सबसे पास में हो edge weight के base पर |

और शुरुआत में random basis पर root vertex का selection करते है|

इस ब्लॉग(Prim’s Algorithm In Hindi) को लेकर आपके मन में कोई भी प्रश्न है तो आप हमें इस पते a5theorys@gmail.com पर ईमेल लिख सकते है|

आशा करता हूँ, कि आपने इस पोस्ट ‘Prim’s Algorithm In Hindi In Data Structure’ को खूब एन्जॉय किया होगा|

आप स्वतंत्रता पूर्वक अपना बहुमूल्य फीडबैक और कमेंट यहाँ पर दे सकते है|

आपका समय शुभ हो|

Anurag

I am a blogger by passion, a software engineer by profession, a singer by consideration and rest of things that I do is for my destination.