• बिज़नस आईडिया
  • हमारा YouTube चैनल
  • सभी मशीन विक्रेताओं के नंबर
  • कंप्यूटर नेटवर्क
  • कंप्यूटर फंडामेंटल
  • इन्टरनेट एंड वेब टेक्नोलॉजी
  • हमारे बारें में
  • हमसे संपर्क करें

Logo

  • इन्टरनेट प्रोग्रामिंग

Algorithm क्या है? परिभाषा और उदाहरण ( हिन्दी नोट्स) – What is Algorithm in Hindi

What is algorithm in hindi.

Algorithm एक प्रक्रिया हैं जिसमे किसी भी काम को आसान बनाने के लिए उसे कई चरणों में विभाजित कर पूर्ण किया जाता हैं. जैसे किसी एक प्रोग्राम को अलग-अलग steps में पुरा किया जाता हैं उसे एल्गोरिथम के माध्यम से अलग – अलग steps में लिखते हैं. जिसकी कोई लिमिट नहीं होती, जब तक पूरा नहीं हो जाता तब तक करते रहते हैं इसी प्रोसेस को ही algorithm कहते हैं.

What is Algorithm in Hindi

Algorithm की परिभाषा?

Algorithm एक set of rules होता है, जो step by step यह सुनिश्चित करता है कि, कोई विशेष कार्य वांछित परिणाम (expected result) के लिए कैसे संपादित किया जाएगा.

Algorithm को प्रोग्रामिंग में प्रोग्राम लिखने से पहले बनाया जाता हैं जिससे बेहतर प्रोग्राम बन सकें। Algorithm का use किसी भी प्रोब्लम को solve करने के लिए किया जाता हैं. algorithm किसी भी प्रोब्लम को step by step solve करता हैं.

मान लो आपको किसी को फोन करना हैं तो इसमें भी बहुत सारे steps होंगे जैसे –

  • Step 1. आप फोन को चेक करेंगे की फोन चालू है या नहीं ।
  • Step 2. फिर ये देखेंगे की उस व्यक्ति का नंबर हैं या नहीं।
  • Step 3. अगर नही हुआ तो लोड करेंगे फिर उस व्यक्ति को फोन लगाएंगे।
  • Step 4. फिर उसका रिंग जाने का wait करेंगे।
  • Step 5. फिर फोन उठाएगा बात करेंगे।

यहां पर एक सिंपल कॉल करने के लिए भी इतने सारे steps को follow करना पड़ता हैं और इसमें से आप किसी step को छोड़ भी नहीं सकते। अगर कोई एक स्टेप छोड़ देते हैं तो हमारा काम नहीं होगा तो इसी प्रकार किसी काम को करने के लिए कुछ स्टेप follow करने पड़ते हैं. जिन्हे प्रोग्रामिंग में algorithm कहा जाता हैं।

Algorithm की complexity?

यहां पर एल्गोरिथम में दो तरह की complexity देखी जा सकती हैं

  • Time complexity – यहां पर टाइम complexity, program को run होने में जितना टाइम लगता हैं उसे ही कहते हैं। अर्थात् एक प्रोग्राम को जितना ज्यादा टाइम लगेगा run होने में उतनी ही अधिक time complexity होगी,अल्गोरिथम की टाइम कॉम्प्लेक्सिटी को Big O notation का use करके present किया जाता है।
  • Space complexity – algorithm step by step रहते हैं अर्थात बहुत सारे लाइंस में रहते हैं जिसको हम इंस्ट्रक्शन भी कहतेहै इसे रखने में जितना अधिक space लगता हैं उसे ही space complexity कहा गया हैं,space कॉम्प्लेक्सिटी को Big O (O(n)) notation के द्वारा present किया जाता है।

एल्गोरिथ्म के प्रकार – Types of Algorithm

  • Greedy algorithm –  ये algorithm सबसे सरल और सबसे सीधी approach है,इस approach में, future की चिंता किये बिना present में available knowledge के आधार पर निर्णय लिया जाता है।
  • Divide and conquer algorithm – इस तकनीक में सबसे पहले एक बड़े problem को छोटे छोटे parts में divide किया जाता हैं फिर उसे solve किया जाता हैं इसलिए इसे divide and conquer algorithm कहा जाता हैं।
  • Recursive algorithm – इस Algorithm में recursion use किया जाता हैं अर्थात् यहां faction खुद को कॉल करतेहैं तथा उसे आगे प्रोसेस पर भेजते हैं।
  • Brute force algorithm – ये किसी problem को solve करने की एक तकनीक हैं, जहां किसी problem के पॉसिबल सॉल्यूशन के साथ एक एक करके उसे टेस्ट किया जाता है। की रिजल्ट किसी problem के कथन को satisfy करता हैं या नहीं
  • Backtracking algorithm – यहां पर problem को sub problem में
  • Dynamic programming algorithm – dynamic programming एक bottom up approach है,  इसमें हम सभी संभावित छोटी problems को solve करते हैं और फिर बड़ी problems के solution को प्राप्त करने के लिए उन्हें combine करते हैं।
  • ऑपरेटिंग सिस्टम क्या है? और कैसे काम करता है?
  • युपीएस क्या है? और कैसे काम करता है?
  • स्टोरेज डिवाइस क्या है? इसके प्रकार और उदाहरण
  • यूऍसबी क्या है और कितने प्रकार के है?

ऍल्गोरिथम के लाभ (Advantage )

यहां पर हम setoff  struct ions को ही algorithm कहते हैं पर तभी उसे algorithm कहेंगे यदि उसमें कुछ विशेषता होगी जो की algorithm में होती हैं सभी set fin struct ions को algorithm नहीं कहा जा सकता, उस के लिए कुछ स्पेशल characteristics होने चाहिए। जो निम्नलिखित हैं।

  • Well-defined input(अच्छी तरह से परिभाषित इनपुट) – एल्गोरिथम में इनपुट अच्छे से समझ आना चाहीए अर्थात् well defined manner में होना चहिए ताकि compute r को समझ में आसानी से आ सके की इनपुट में क्या दीया गया हैं, ताकि उसका आउटपुट सही तरीके से जेनरेट किया जा सके।
  • Well defined output(अच्छी तरह से परिभाषित आउटपुट)- algorithm के हर प्रोग्राम में सही तरीके से आउटपुट प्रदान करना चाहिए ताकि user को अच्छे से समझ आ जाए की उसके दिए गए टास्क को सही तरीके से solve किया गया हैं या नहीं।
  • Finiteness(निश्चित स्टेप्स)- finiteness का अर्थ होता हैं किसी भी algorithm में loops की संख्या सीमित होनी चाहिए अर्थात्जितनेबार loop चलाने की जरूरत हैं उतने बार ही चलना चाहिए। infinite नहीं होना चाहिए।
  • Feasible(होने लायक)- algorithm सरल, सामान्य और व्यावहारिक होना चाहिए, जैसे किय ह उपलब्ध संसाधनों को निष्पादित किया जा सकता है। इसमें कुछ भविष्यकीतकनीक, या कुछ भीशामिल नहीं होना चाहिए।
  • Language in dependent(किसी भी भाषा पर डिपेंडना हों)- यहां पर Algorithm को किसी भी प्रोग्रामिंग भाषा पर आधारित नहीं होना चाहिए. इसे सामान्य भाषा में लिखा होना चाहिए| जिसे कभी भी किसी भी प्रोग्रामिंग भाषा में बदला जा सके. किसी भी प्रोग्रामिंग भाषा में बदलने के बाद एक ही तरह का वांछित परिणाम मिलना चाहिए.

ऍल्गोरिथम के कमियाँ (Disadvantage )

  • Algorithm बहुत ही time taking होता हैं अर्थात् algorithm को लिखने में काफ़ी time लगता हैं।
  • बड़े प्रोजेक्ट के लिए ये सही नहीं होता क्योंकि इसमें पहले बहुत बडा एल्गोरिथम लिखना पड़ता हैं फिर flow chart बनाना पड़ता है और फिर प्रोग्रामिंग करनी होती हैं, तो इसमें बहुत अधिक समय लग जाता हैं इसलिए ये बड़े प्रोजेक्ट के लिए अच्छा नहीं है।
  • Complex logic को algorithm की मदद से समझाना मुश्किल हो जाता है।
  • Algorithm में looping और branching को दर्शाना काफ़ी मुस्किल होता हैं।

Factors of Algorithm in Hindi – एल्गोरिथम के फैक्टर

किसी algorithm को लिखने से पहले कुछ factors को ध्यान में रखना पड़ता हैं

  • Extendible – algorithm extensible होनी चाहिए ताकि कोई भी प्रोग्रामर या डिजाइनर इसका उपयोग future में कर सकें।
  • Robustness – ये program की capacity होती है जिससे प्रोग्राम अच्छे से डेवलप और रन हो सके। ये सभी प्रोग्राम में होना चाहिए।
  • Functionality – algorithm में अलग अलग तरीके की functionality होनी चाहिए ताकि प्रोग्राम attractive और उपयोग करने में आसान हो।
  • Simplicity – algorithm सिंपल होना चाहिए अर्थात् उसमे सिंपल लेंग्वेज का उपयोग किया जाना चाहिए ताकि सबके लिए समझना आसान हो और काम करना भी आसान हो।
  • Modularity – किसी दिए गए प्रोग्राम को छोटे छोटे programs या steps में तोड़ना ही modularity कहलाती हैं।
  • Correctness – algorithm correct होना चाहिए ताकि उससे सही आउटपुट आ सके और कभी भी run करने पर वही same output आए।
  • User friendly –   algorithm यूजर फ्रेंडली होना चाहिए ताकि यूजर comfort के साथ काम कर सकें और algorithm बनाने में कठिनाई महसूस ना करे।

Algorithm की जरूरत क्या हैं?

Algorithm किसी प्रोग्राम को easy बनाता है, हम algorithm के जरिए किसी प्रोग्राम को बनाने से पहले उसके steps लिखने के लिए उपयोग करते है, जिससे की प्रोग्राम की रूपरेखा आसनी से समझ आ सकें और प्रोग्राम का उद्देश्य समझना आसान हो जाए।

Algorithm का एक उदाहरण?

write Algorithm To find smallest of three numbers

 1.Start

2. Read 3 numbers : num1,num2,num3

 3. If num1< num2 than go to step 5

  4. If num2<num3 than

        Print num2 is smallest

       Go to step 6

5. If num1 < num3 than

Print num1 is smallest

       Print num3 is smallest

एल्गोरिथम क्या हैं

what is algorithm in hindi

एल्गोरिथम निर्देशो का एक ग्रुप हैं जिसके जरिए हम प्रोग्राम के स्तर को आसनी से समझ सकते हैं इसके द्वारा किसी भी विशेष प्रकार के समस्या का समाधान किया जा सकता हैं ।

एल्गोरिथम के प्रकार

algorithm kya hai hindi

एल्गोरिथम के बहुत सारे प्रकार होते हैं – डिवाइड एंड conquer, ब्रूट फॉर्स एल्गोरिथम, रोडमाइज्ड एल्गोरिथम, ग्रीडी एल्गोरिथम, रिकर्सिव एल्गोरिथम, बैकट्रेकिंग एल्गोरिथम, डायनेमिक प्रोग्रामिंग एल्गोरिथम।

एल्गोरिथम और फ्लोचार्ट में क्या अंतर है?

एल्गोरिथम किसी problem को सॉल्व करने की एक प्रक्रिया हैं और फ्लोचार्ट एक डायग्रामेटिकल रिप्रेजेंटेशन हैं।

आज आपने सिखा

यहाँ हमने एल्गोरिथम (What is Algorithm in Hindi) की पूरी जानकारी को हिन्दी में देने की प्रयास किया है। एल्गोरिथम (What is Algorithm in Hindi ) प्रोग्रामिंग का महत्वपूर्ण पार्ट है जिसके बिना प्रोग्रामिंग करना बहुत ही मुस्किल होता है अल्गोरिथम की मदद से आसानी से प्रोग्राम तैयार किये जा सकते है. मुझे पूरा विश्वाश है की यदि आपने इस पोस्ट को पूरा पढ़ा होगा तो आपको अल्गोरिथम (What is Algorithm in Hindi) से जुड़े विभिन्न तथ्यों की जानकारी मिल गया होगा.

यदि यह पोस्ट ( What is Algorithm in Hindi ) आपको अच्छा लगा हो तो अपने दोस्तों को फेसबुक, Whatsapp और इन्स्ताग्राम इत्यादि में इस पोस्ट What is Algorithm in Hindi को शेयर जरुर करें. इसी प्रकार के नए-नए टेक्नोलॉजी और बिजनेस स्टार्टअप की जानकारी के लिए आप मेरे YouTube चैनल computervidya और मेरा वेबसाइट nayabusiness.in में विजिट जरुर करें.

Keyboard in Hindi / कीबोर्ड क्या है? Keyboard kya hai – हिन्दी नोट्स

हाई लेवल लैंग्वेज क्या हैं परिभाषा और उदाहरण (हिन्दी नोट्स) – what is high..., leave a reply cancel reply.

Save my name, email, and website in this browser for the next time I comment.

  • Chat GPT क्या है और काम कैसे करता है?
  • घरेलु महिलाओं के लिए 25 बेस्ट बिज़नस
  • क्लाउड कम्प्यूटिंग क्या हैं? (हिन्दी नोट्स)
  • OSI Model क्या है? विस्तार से समझाइए।
  • IP Address क्या है और कैसे काम करता है?
  • Virus क्या है और कितने प्रकार के होते है?
  • Cryptography क्या है? (हिन्दी नोट्स)
  • गोबर से जुड़े 15 बेस्ट बिज़नस आइडियाज
  • मशरूम की खेती कैसे शुरू करें?
  • कम्प्युटर का इतिहास और विकास
  • Microprocessor क्या है? (हिन्दी नोट्स)
  • कंप्यूटर की सभी 6 पीढ़ियां, विशेषता, कमियाँ
  • कंप्यूटर नंबर सिस्टम क्या है - हिन्दी नोट्स
  • नेटवर्क डिवाइस क्या है और कितने प्रकार के होते है?
  • बेसिक इन्टरनेट टर्मिनोलॉजी-हिंदी नोट्स
  • Privacy Policy
  • Terms and Conditions

Complete Video Learning

  • All Courses
  • o level Course

Algorithms tutorials in Hindi(Beginner for Coding)

User Avatar

Requirements

  • No Requirements
  • The concept of an algorithm is one of the basic concepts in mathematics.
  • Algorithm is a step-by-step problem solving procedure that can be Carried out by a computer.
  • Finiteness: An algorithm should terminate after a finite number of steps, that is, when it is mechanically executed, it should come to a stop after executing a finite number of. Assignment, decision and repetitive steps.
  • Definiteness: An algorithm should be simple. Each step of the algorithm should be precisely defined, that is, the steps must be unambiguous so that the computer understands them properly.
  • Generality: An algorithm should be complete in itself, that is, it should be able-to solve all problems of a particular type.
  • Effectiveness: All the operations used in the algorithm should be basic and capable of being performed mechanically.
  • Input-output: An algorithm should take certain precise inputs, or initial data, and the outputs should be generated in the intermediate as well as the steps of the algorithm.

Target audiences

  • Beginner for coding programming Language
Welcome to Algorithms tutorials in Hindi(Beginner for Coding)

Leave a Reply Cancel reply

You must be logged in to post a comment.

Contribute Now

SHOW YOUR SUPPORT FOR NIELITBHU..!! Dear reader, thank you for joining us. Readers like you are an inspiration for us to pursue NIELITBHU. We need your support or cooperation to further empower NIELITBHU and reach NIELITBHU more people in every corner of the country. Your every support is invaluable to our future.

Don’t miss Join Our Community!

Modal title.

Master Programming

Algorithm क्या है? – What is Algorithm in Hindi

जब कभी आपने गूगल में कुछ सर्च किया होगा तब आपको गूगल सर्च रिजल्ट में कुछ पेज दिखाई दिए होंगे |  गूगल, सर्च रिजल्ट में इन पेजो को दिखाने के लिए कुछ विशेष Algorithm का उपयोग करता है | 

मगर ये Algorithm Kya Hai? इसका क्या उपयोग है? और कंप्यूटर प्रोग्रामिंग में एल्गोरिथ्म कैसे लिखा जाता है? आदि कुछ सवाल है जिनके बारे में आज हम इस आर्टिल्स में बात करने वाले है | 

तो आइये बना समय गवाए जानते है कि एल्गोरिथ्म क्या है? (What is Algorithm In Hindi)

एल्गोरिथ्म क्या है? (What is Algorithm in Hindi)

एल्गोरिथ्म क्या है? (What is Algorithm in Hindi)

Definition -: “किसी स्पेसिफिक प्रॉब्लम को सॉल्व करने के लिए लिखा जाने वाला step by step प्रोसीजर Algorithm कहलाता है |”

Algorithm” शब्द का अर्थ है “process या set of rules या problem-solving operations”

Algorithm, किसी प्रॉब्लम को सॉल्व करने का एक procedure या step by step इंस्ट्रक्शन है |

एल्गोरिथम में एक बड़े स्टेप को छोटे-छोटे स्टेप्स में तोड़कर लिखा जाता है | 

Algorithm कुछ set of instructions है जो किसी विशिष्ट कार्य (जैसे दो नंबर को जोड़ने या फिर कोई काम्प्लेक्स ऑपरेशन भी हो सकता है) को करने के लिए डिज़ाइन किये जाते है | 

Search engines भी कुछ विशेष Algorithm का उपयोग सर्च रिजल्ट में पजो को दिखाने के लिए करते हैं।

ऐसे कई मामलों में किसी सॉफ्टवेयर प्रोग्राम के भीतर किसी ऑपरेशन को परफॉर्म करने के कई असारे तरीके हो सकते है इसलिए उन सभी तरीको में से सबसे सही तरीके को लागु करने के लिए एक कुशल Algorithm बनाया जाता है | 

अत्यधिक कुशल Algorithm का उपयोग करके, डेवलपर्स यह सुनिश्चित कर सकते हैं कि उनके प्रोग्राम्स यथासंभव तेजी से चलें और कम से कम सिस्टम रिसोर्सेज का उपयोग करें। 

बेशक, सभी Algorithm पहली बार पूरी तरह से नहीं बनाए जा सकते इसलिए, डेवलपर्स अक्सर मौजूदा Algorithm में सुधार करते रहते हैं और उन्हें भविष्य के सॉफ़्टवेयर अपडेट में शामिल करते रहते हैं।

जब आप किसी सॉफ़्टवेयर प्रोग्राम का new version देखते हैं जिसे “optimized” किया गया है या जिसका “faster performance” है, तो इसका अर्थ है कि नए संस्करण में अधिक कुशल Algorithm शामिल किया गया हैं।

प्रोग्रामिंग एल्गोरिथ्म क्या है? (What is Algorithm in Computer Programming)

प्रोग्रामिंग एल्गोरिथम एक procedure या sequence of instruction है जो कंप्यूटर को बताती है कि क्या करना है और कैसे करना है | 

कंप्यूटर एल्गोरिथम language-independent होता हैं, यानी एल्गोरिथम ऐसे निर्देश हैं जिन्हें किसी भी लैंग्वेज में अप्लाई किया जा सकता है | 

एक बार जब आप अपने Algorithm को किसी लैंग्वेज में बदल देंगे जिसे वह समझता है तो कंप्यूटर इसे हर बार ठीक उसी तरह करेगा जिस तरह Algorithm में बताया गया होगा। 

हालांकि, यह बात ध्यान रखना महत्वपूर्ण है कि प्रोग्रामिंग एल्गोरिदम कोई कंप्यूटर कोड नहीं है। यह साधारण अंग्रेजी में लिखा गया इंस्ट्रक्शन या स्टेप्स है। 

इसमें केवल वही चीजे शामिल होती है जो आपको कार्य पूरा करने के लिए आवश्यक होते है। इसमें unclear कुछ भी शामिल नहीं होता।

आप प्रोग्रामिंग एल्गोरिथम को एक recipe के रूप में मान सकते हैं जो किसी प्रॉब्लम को सॉल्व करने या लक्ष्य तक पहुंचने के लिए कंप्यूटर के लिए आवश्यक steps को describe करता है।

कुछ लोग केवल फ़्लोचार्ट डायग्राम या pseudocode का उपयोग करते हैं, जिसके बारे में हम आगे बात करेंगे | अभी के लिए हम अब एल्गोरिथ्म को एक उदाहरण द्दारा समझने का प्रयास करते है -:

Example of Algorithm -:

जैसे की हम कोई व्यंजन बनाने के लिए कुछ स्टेप्स ऑफ़ रूल्स फॉलो करते है ठीक उसी तरह किसी प्रोग्राम को बनाने के लिए हम Algorithm डिज़ाइन करते है | ये Algorithm उस प्रोग्राम को कुशल तरीके से बनाने में उपयोग होने वाला सेट ऑफ़ रूल्स को describe करते है | 

Example 1: केतली में पानी उबालने का तरीका बताना।

कंप्यूटर को दिए गए निर्देश किसी मित्र को दिए गए निर्देशों से भिन्न होते हैं। आइए उनके बीच के अंतर को देखें और जानें कि कंप्यूटर को निर्देश कैसे दिया जाता है और इसके लिए एल्गोरिथ्म कैसे लिखा जाता है।

Instructions to a Friend:

  • Step 1: केतली को पानी से भरें।
  • Step 2: इसे स्टोव पर रखें और बर्नर चालू करें।
  • Step 3: जब पानी उबलने लगे तो बर्नर को बंद कर दें।

Instructions to the Computer:

  • Step 1: केतली को नल के नीचे रखें।
  • Step 2: नल चालू करें।
  • Step 3: जांचें कि केतली का 90% भरा हुआ है या नहीं।
  • Step 4: यदि नहीं, तो उपरोक्त चरण को दोहराएं।
  • Step 5: नल बंद करें।
  • Step 6: केतली को बर्नर में रखें।
  • Step 7: बर्नर चालू करें।
  • Step 8: जाँच करें कि पानी 100 C है या नहीं
  • Step 9: यदि नहीं, तो उपरोक्त चरण को दोहराएं।
  • Step 10: बर्नर बंद करें।

Example 2 -:

Instruction to a Friend:

  • Step 1: कॉलेज बोर्ड के पास जाना |
  • Step 2: बोर्ड पर मेरा नाम सर्च करना |
  • Step 3: मेरे नाम के सामने क्या रैंक है उसे चेक करना | 
  • Step 1: कॉलेज बोर्ड पर जाएं।
  • Step 2: पहला नाम पढ़ें।
  • Step 3: यदि यह मेरा नाम है, तो रैंक देखें और वापस आएं
  • Step 4: यदि यह मेरा नाम नहीं है तो अगला नाम पढ़ें।
  • Step 5: उपरोक्त दो चरणों को तब तक दोहराएं जब तक आपको मेरा नाम न मिल जाए।

ऊपर बताये गए उदाहरण को आप एक बार ध्यान से देखे! इस उदाहरण में मैंने कंप्यूटर से कार्य कराने के लिए जो इंस्ट्रक्शन या स्टेप्स बताये है वही एल्गोरिथ्म है 

प्रोग्राम लिखने का प्रयास करने से पहले एल्गोरिथम को लिखना एक अच्छा प्रैक्टिस माना जाता है। एल्गोरिथम का प्रत्येक स्टेप प्रोग्रामिंग लैंग्वेज में एक लाइन या set of lines में परिवर्तित हो जाता है।

एल्गोरिथ्म की विशेषताएं (Characteristics of an algorithm)

जैसा कि कोई व्यंजन बनाने के लिए हम केवल कुछ standard इंस्ट्रक्शन को फॉलो करते है इसी तरह, प्रोग्रामिंग के लिए सभी इंस्ट्रक्शन एक एल्गोरिथम नहीं होते  । एल्गोरिथम बनने के लिए इनमे निम्नलिखित विशेषताएं होनी चाहिए:

1. Clear and Unambiguous -: Algorithm स्पष्ट होने चाहिए। इसके प्रत्येक steps सभी पहलुओं में Clear होने चाहिए और मीनिंग भी केवल एक ही होने चाहिए।

2. Well-Defined Inputs -: यदि कोई Algorithm इनपुट लेने के लिए कहता है, तो यह इनपुट अच्छी तरह से defined होना चाहिए।

3. Well-Defined Outputs -: एल्गोरिथम को स्पष्ट रूप से define करना चाहिए कि कौन सा आउटपुट प्राप्त होगा | 

4. Finite-ness -: एल्गोरिथ्म finite या सिमित होना चाहिए, अर्थात यह एक अनंत लूप या समान में समाप्त नहीं होना चाहिए। इसकी एक सीमा होनी चाहिए | 

5. Feasible -: एल्गोरिथ्म सरल, सामान्य और व्यावहारिक होना चाहिए | यह available resources पर execute किया जा सके | 

6. Language Independent -: डिज़ाइन किया गया एल्गोरिदम Language Independent होना चाहिए, यानी यह केवल plain instructions होने चाहिए जिसे किसी भी Language में अप्लाई किया जा सके, और फिर आउटपुट वही हो, जैसा की expected था।

एल्गोरिथम के फायदे (Advantages of Algorithm In Hindi)

  • एल्गोरिथ्म को समझना आसान होता है।
  • एल्गोरिथम किसी समस्या के समाधान का step-wise representation है।
  • एल्गोरिथम में समस्या को छोटे-छोटे टुकड़ों या चरणों में तोड़ दिया जाता है, इसलिए प्रोग्रामर के लिए इसे वास्तविक प्रोग्राम में बदलना आसान हो जाता है।
  • एल्गोरिथम के प्रत्येक चरण का अपना logical sequence होता है, जिससे डिबग करना आसान हो जाता है।

एल्गोरिथम के नुकसान (Disadvantages of Algorithm In Hindi)

  • एल्गोरिथम लिखने में लंबा समय लगता है इसलिए यह time-consuming है।
  • एल्गोरिथम में ब्रांचिंग और लूपिंग स्टेटमेंट show करना मुश्किल होता है | 

Algorithm शब्द कहा से आया? 

‘Algorithm” शब्द पर्शियन माथेमैटिशन “Muhammad ibn-Musa al-Khwarizmi” (जिन्होंने मैथेमेटिक्स के साथ , कंप्यूटर साइंस , जियोग्राफी, आदि क्षेत्रों में अपना अहम् योगदान दिया) के नाम से आया | 

al-Khwarizmi शब्द से algorism शब्द आया और फिर algorism से algorithm शब्द बना | 

Algorithm के प्रकार (Types of Algorithm)

अलग अलग प्रॉब्लम को सॉल्व करने के लिए अलग अलग प्रकार के अल्गोरिथम का उपयोग किया जाता है | इनमे से कुछ प्रमुख Algorithm निम्नलिखित है -:

  • Simple recursive algorithms.
  • Backtracking algorithms.
  • Divide and conquer algorithms.
  • Dynamic programming algorithms.
  • Greedy algorithms.
  • Branch and bound algorithms.
  • Brute force algorithms.
  • Randomized algorithms.

ये सभी Algorithm के प्रकार है जिनके बारे में हो सकता है कि आपको कुछ न पता हो इसलिए मैंने निचे एक इंग्लिश आर्टिकल का लिंक दिया है जहाँ से आप एल्गोरिथ्म के इन प्रकारो के बारे में पढ़ सकते है | 

Read More -:

  • What is Flowchart
  • What is Pseudo Code
  • What is Programming

तो दोस्तों आज के इस आर्टिकल में हमनें जाना कि एल्गोरिथ्म क्या है? (What is Algorithm In Hindi) एल्गोरिथ्म कितने प्रकार के होते है? (Types of Algorithm In Hindi) और एल्गोरिथ्म उपयोग करने के क्या फायदे और क्या नुकसान है? (Advantages and Disadvantages of Algorithm in Hindi)

अगर आपको ये पोस्ट पसंद आया है तो इस पोस्ट को अपने दोस्तों को शेयर करना न भूलिएगा ताकि उनको भी Algorithm Kya Hai के बारे में जानकारी प्राप्त हो सके |

अगर आपको अभी भी What is Algorithm in Hindi से संबंधित कोई भी प्रश्न या Doubt है तो आप कमेंट्स के जरिए हमसे पुछ सकते है। मैं आपके सभी सवालों का जवाब दूँगा और ज्यादा जानकारी के लिए आप हमसे संपर्क कर सकते है |

ऐसे ही नया टेक्नोलॉजी, Computer Science, computer fundamentals से रिलेटेड जानकारियाँ पाने के लिए हमारे इस वेबसाइट को सब्सक्राइब कर दीजिए | जिससे हमारी आने वाली नई पोस्ट की सूचनाएं जल्दी प्राप्त होगी |

' src=

Jeetu Sahu is A Web Developer | Computer Engineer | Passionate about Coding and Competitive Programming

Sir kya ham algorithm ko or flow chart ko computer me banaynge jase programming ko banate hai

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Save my name, email, and website in this browser for the next time I comment.

Algorithm क्या है और आसानी से कैसे लिखें?

Photo of author

शायद आपको पता नहीं होगा ऍल्गोरिथम क्या है (What is Algorithm in Hindi) और आपको अगर यह नहीं पता तो आपको Algorithm कैसे लिखें यह भी नहीं पता होगा. लेकिन आज मैं आपको, आपके दोनों सवालों के जवाब के साथ साथ कुछ और जानकारी देने की कोसिस करूँगा जो की Algorithm सम्बन्धी होगा। जिससे आपके सारे सवालों के जवाब मिल जाएँ वो भी हिंदी में।

Computer से कुछ कार्य कराने के लिए, Computer Program लिखे जाते हैं। अब Computer Program में हम बहुत सारे Steps लिखते हैं। जिन Steps को Computer Execute करता है और कार्य को ख़तम करता है। शब्द, Algorithm का मतलब उन ‘ Series of Steps ‘ से है, जो किसी विशेष गणना (Computation) या कार्य (task) को पुरा करने या निष्पादित (execute) करने के लिये जिम्मेदार होते है।

जब आप Computer को कुछ कार्य बताते हैं तब आप यह भी सोचते ही होंगे की कैसे Computer इन कार्य को करता है। इसके लिए हम इस्तमाल करते हैं Computer Algorithm. तो चलिए बिस्तर से जानते हैं के ऍल्गोरिथम क्या होता है ।

ऍल्गोरिथम क्या है (Algorithm in Hindi)

Algorithm (Al-go-rith-um) यह एक तरीक़ा है (Step by Step Process) या फिर यह एक Formula है। जो की एक Problem को Solve करता है। यह एक ऐसा Procedure है जिसमे सीमित नियम होते हैं, जिनको Instruction भी कहा जाता है।

Algorithm Kya Hai Hindi

जिन नियमों को एक के बाद एक लिखा जाता है और हर एक नियम(Steps) कुछ ना कुछ Operation को दर्शाते है. इन नियमों के जरिए Problem का Solution निकलते हैं।

  • कंप्यूटर विंडोज क्या है और इसका इतिहास
  • सॉफ्टवेयर क्‍या होता है
  • CPU क्या होता है

Algorithm की परिभाषा

दुसरे सब्दों में कहें तो Algorithm किसी भी समस्या या Problem का समाधान निकलने की Step by Step प्रक्रिया है। अब और थोडा सरल भाषा में समझते हैं Algorithm में कुछ Steps होते हैं, जिनमे हर एक Step एक Operation को दर्शाता है।

एक Step शुरूवात करता है और आखिर में एक Step रहता है जो ख़तम करता है और इन दोनों Steps के बिच में और बहुत सारे Steps होते हैं जो अलग अलग कार्य करते हैं।

जैसे चावल बनाना यह आपकी Problem है. इस काम को ख़तम करने के लिए चलिए कुछ Steps लिखते हैं. पहले चावल को धोना होगा फिर, पानी गरम करो और पानी गरम करने के उसमे चावल डालना है और चावल के उबलने का इंतजार करना होगा।

10-15 मिनट में चावल बन के तयार. अब यहाँ  हर एक steps कुछ न कुछ Operation को Perform करते हैं. जैसे चावल धोना मतालब इसमें कचे चावल में पानी डालके धोया जाता है. ऐसे ही हर Steps में अलग अलग Operations होते हैं. देखिए यहाँ हम Problem को छोटे छोटे Steps में divide कर दिए यही तो है जिसको आपको सझना था।

Programming में Algorithm का इस्तमाल बहुत है। तो चलिए विस्तार से जानते हैं कैसे और कहाँ इनका इस्तमाल होता है।

एल्गोरिथ्म के फाउंडर कौन है?

इसका एक लंबा इतिहास (History) है, परंतु वास्तविक शब्द “Algorithm” का परिचय पहली बार 9 वीं शताब्दी में हुआ। उस समय के फारसी गणितज्ञ, Abu Abdullah Muhammad ibn Musa Al-Khwarizmi को इसका फाउंडर माना जाता है। इन्हें बीजगणित के जनक (The Father of Algebra) के रूप में भी जाना जाता है।

Algorithm का उपयोग / महत्व

Algorithm का इस्तमाल तो हर जगह है जैसे आप पने हर दिन की समस्याओं का जवाब भी आप इस Step by Step Process के जरिए निकाल सकते हो. Technically हम बोले तो ज्यदा इस्तमाल IT Industry, Business Model, Programming में किया जाता है.

Characteristics Of Algorithm in hindi

आपको पता ही है यह Algorithm एक Step by Step Procedure है. जो ये स्पस्ट करता है की Steps किस क्रम में Execute होंगे जिसे हमें Desired (आकांक्षा जनक) Output मिल सके. Algorithm को दो कारक के जरिए analyze  किया जाता है. जैसे Time और Space।

Time यह बताता है की Algorithm लिखने के लिए कितना समय लगेगा और Space से यह पता चलता है की कितने कम समय में हम लिख सकते हैं. अब इसके Characteristics  के बारे में बात करते हैं।

Unambiguous

जो भी अल्गोरिदम आप लिखें वह स्पष्ट और सठिक होना अति अवश्यक है. हर एक step या Line का कुछ Meaning होना चाहिए।

हर एक Algorithm कुछ सिमित Steps के अंदर ख़तम होना चाहिए. और हर step Finite यानि सिमित बार Repaet होना चाहिए. steps का Exection भी सिमित समय के लिए होना चाहिए. हर एक Step का कुछ कुछ न कुछ Meaning होना चाहिए।

हर Algorithm में O या फिर O से ज्यादा सठिक steps होने चाहिए।

जैसे हर Algorithm का Input Step होते हैं वैसे ही Algorithm का Output Step भी होना चाहिए. Output भी वही आना चाहिए जिसके लिए हम लिखे हैं।

Effectiveness

Time और Space से  Effectiveness का अंदाजा लगाया जाता है. अगर algorithm कम time और Space में लिखा जाता है. या फिर कम समय में Execute होता है और  कम Space में Run होता इसे ही Effectiveness कहते हैं।

Data structure के मुताबिक यह सब Important Categories होनी चाहिए.

  • Search -item को DATA Structure में Search आसानी से सर्च कर सकें.
  • Sort -एक लिस्ट को Order कर सके या Sorting कर सकें.
  • Insert – data Structure में algorithm को Insert कर सकें.
  • Update – AlGORITHM के जरिए Item को update करने की ख्यामता हो.
  • Delete – Algorithm से जो item data structure में है उसे Delete कर ने में असुविधा न हो.

Algorithm की Complexity

दो factors को ध्यान में रख के Algorithm की Complexity को Classify किया गया है. एक Time Complexity और दूसरा Space Complexity।

Time Complextiy :

Program को Run होने में जितना टाइम लगता है।

Space Complexity :

computer के अंदर Program को Execute होने के लिए जितना Space चाहिए उसे Space Complexity कहते हैं।

एल्गोरिथ्म के प्रकार – Types of Algorithm

हालांकि इसके कई सारे प्रकार है, परन्तु जो सबसे बुनियादी प्रकार है उन्हें नीचे बताया गया है।

  • Simple Recursive Algorithms
  • Backtracking
  • Divide and Conquer
  • Dynamic Programming Algorithm
  • Greedy Algorithms
  • Branch and bound Method
  • Brute Force Algorithms
  • Randomized Algorithms

Algorithm कैसे लिखें

इसको लिखना बड़ा ही आसान है आपको कुछ ज्यादा सिखने की आवस्यकता ही नहीं. आपको को पता होगा सुरुवात में एक उदहारण लिए थे जहाँ एक ex- था चाय कैसे बनानाते हैं।

उसी तरह आपको लिखना है Step by Step. Algorithm की जादा जरुरत Programming में होती है. आप Direct भी लिख सकते हो या आप कुछ rules का इस्तमाल करके भी लिख सकते  सकते हैं।

Rules जैसे Start, Input, Output, Read, Variable, Display, Stop . निचे दिए गए Example को एक बार देख लें जिसे आपको समझने में आसानी होगी।

Q1. दो Number को को enter करें और दोनों Numbers का Sum निकालें?

हर algorithm में सुरुवात में Start और अंत में Stop/End लिखें जैसे निचे लिखा गया है।

इसके बाद देखें की कितने Variables की जरुरत है या क्या Input करना है. जैसे निचे दो numbers को Sum करने के लिए 3 Variables चाहिए. Num1 पहले number के लिए Num2 दुसरे Number के लिए और sum variable Num1+num2 को Store करने के लिए. तो आपको इन variables के बारे में सोचें और लिखना सुरु करें।

अब कुछ steps ऐसे होंगे जहाँ हमें Arithmetic Operation जैसे +, -, ×, ÷ करने होंगे और कुछ Logical Operation जैसे Comparision Operation, True False, जीनका Output O (false) और 1 (True) होता है. Arithmetic तो आपको पता ही है (+, -, ×, ÷ ) और Logical का एक Example जैसे आपको जानना है. “Largest Number among 2 Number” तो यहाँ आप दोनों Numbers को Compare करोगे. इन Symbols का इस्तमाल कर के “>, <, >=, <=, !=”।

अब आखिर में जो Result आता है उसको आप Display लिख के Display कर सकते हैं और अंत Step में Stop या End लिख दें. अब इस उदाहरण को धयान से समझें।

Step 1 : Start  //स्टेप स्टार्ट हुआ

Step 2 : Declare variables num1, num2 and sum.    //num1, Num2, Sum वेरिएबल बनाएं जहाँ कोई भी संख्या स्टोर होगी

Step 3 : Read values num1 and num2.     //जब keyboard से Number enter होगा तो यहाँ read होगा

Step 4 : Add num1 and num2 and assign the result to sum. Sum=num1+num2   //दो numbers का जोड़, Sum में Store होगा

Step 5 : Display sum     //sum को Display करें

Step 6 : Stop //समाप्त

अब कुछ और उदहारण देख के समझने की कोसिस करें।

Step 1 . Start Step 2 . Read the number n Step 3 . [Initialize] i=1, fact=1 Step 4 . Repeat step 4 through 6 until i=n Step 5 . fact=fact*i Step 6 . i=i+1 Step 7 . Print fact Step 8 . Stop

आज आपने क्या सीखा

हमेसा से मेरी कोशिश रहती है की आपको सही और सठिक और पूर्ण Inforamtion आपको मिले. आशा करता हूँ आपको समझ आ गया होगा के ऍल्गोरिथम क्या है (Algorithm in Hindi) ।

शायद अगली  बार जब आप लिखो गे तो याद रखना इन कुछ बातों को- आप को Program में कितने Variable चाहिए और Compute क्या करना है. कोन कोन से Operation करने हैं. जिसे लिखने में आसानी होगी. कोसिस करने वालों की कभी हार नहीं होती।

आपसे यही उमीद है ये लेख पसंद आया होगा, कैसा लगा आप जरुर निचे बताइए. अगर अभी बी कोई सवाल आप पूछना चाहते हो तो निचे Comment Box में जरुर लिखे. कोई सुझाव या सलाह देना चाहते हो तो जरुर दीजिये जो हमारे लिए काफी उपयोगी हो।

सॉफ्टवेयर क्या है और कितने प्रकार के होते है?

कंप्यूटर क्या है, चलिए जानते हैं बेसिक जानकारी, कंप्यूटर वायरस क्या है: प्रकार, बचाव के उपाय, और क्या करें.

एटीएम का फुल फॉर्म क्या है?

सॉफ्टवेयर अपडेट करने से क्या होता है?

Leave a Comment Cancel reply

Comments (46).

आपने बहुत अच्छे से समझाया ओर अच्छा example दिया

धन्यवाद आपको आपके जीवन में कामयाबी मिले ।

Bahut Pardarshita aapkay content ki.

Bhut accha lga ho sake to Or saral me bhi samjhana thankyou………..

bahut hi saral bhasha me smjhaya …plz read my artical also!

Nice thanks you aap ne bahut hi valuable knowledge di

good guidence for me thankyou

This is a very smart proscsu of teaching so iam very happy because I understand this

Very nice explain thanku sir ji

Very informative and useful

Thank you so much sir

Hello sir am sajid and am Hsc passed but me aage padhai nhi kr saka lekin abhi me software engineering ki padhai krna chahta hun to plz aap mujhe Bta skte hy kaha se start krun kya subject lene honge mujhe plz reply fast sir thank you for algorithm in Hindi explain

Very nice and Thanks

Achha laga sir Mujhe algorithm pdf file send kar do sir

Thanku so much sir

Nice Explanation Thank you Brother

Tnks his a very easy difinition of algorithm in hindi

Thank you sir

Thnx for information

Excellent and thanks

Thank you so much sir my problem this solve.

Vvvvv. Good & Thanks

It’s very useful and understanding easily ways.

algorithm ka leap year

I like your way of explaining the topic.. It is very helpful.. Thank you so much

Very very very very very very very very best details of algorithm

very nice sir ji

gajab sar ji aap ne bahot achchi tarah se samjaaya

Thank you so much sir I shall understand

Dhanyavad sir jii

Dear Sir Kindly send notes of Data analysis and algorithm in hindi

Bahut badiya

usefull information for all

Hello Sir, Really nice info sir. me already pyle pdhke bhul chuka tha bt ye pdhne ke bad or jada smj aaa gya..o rn kbi bhulunga…………………. thanks a lot Sir

Welcome Akash ji.

Thankyou so much sir

मुझे तो एल्गोरिथम के बारे में पता ही नही था क्या होता है साझा करने के लिए धन्यवाद

Ek baar flow chart bhi dekh lijiye

बहुत ही उम्दा आर्टिकल लिखते है आप।

Hello Sir Apki Guest Post HindiMehelp me Padhi Meko Kaafi Pasand Aayi. Iske Liye Apka Thanks.

Thanks Madhu ji, sunkar bahut achha laga. Ye sab aap hi logon ka pyaar hai jo ki hame jyade se jyada likne ke liye prerit karta hai.

India is great. Thank you

bahut hi badiya or shandar. Thanks sir, share karne ke liye…

HindiMe.net

हिंदी में ब्लॉग पर टेक्नोलॉजी, गाइड, ऑनलाइन पैसे कमाने के तरीके, SEO और ब्लॉग्गिंग की जानकारी मिलती है।

QUICK LINKS

WIKI । ABOUT । CONTACT । PRIVACY

Copyright © 2016 - 2024  HindiMe , All Rights Reserved.

Algorithm क्या है? प्रकार और विशेषताएं – What is Algorithm in Hindi

हैलो दोस्तों, आज हम आपको इस पोस्ट में Algorithm के बारे में पूरी जानकारी देंगे। Algorithm क्या है और Algorithm कैसे काम करता है। और भी बहुत कुछ जो आपको जरूर जाना चाहिए। हम आज जिस इंटरनेट और इंटरनेट पर तमाम जो भी सर्च इंजन जैसे Google,Bing,Yahoo etc. यह सब सर्च इंजन एक एल्गोरिथम के तहत अपना काम करते हैं। आगे इस आर्टिकल में हम इसी एल्गोरिथ्म सिस्टम के बारे में आपको जानकारी देंगे।

सामग्री की तालिका::

Algorithm क्या है- What is Algorithm in Hindi

Algorithm क्या है

Algorithm में मुख्यतः Computational Problems का हल निकालने के लिए सीमित निर्देशों को Add किया जाता है।एल्गोरिथम में किसी भी प्रकार का कार्य करने से पहले सीमित निर्देशों को तैयार किया जाता है। इन्हीं Instructions के आधार पर Algorithm कार्य करता है।

अगर आप में से कोई भी Programmer बनना चाहता है। तो उसे एल्गोरिथ्म के बारे में कंप्यूटर साइंस में पूरी जानकारी दी जाती है।आइए अब उदाहरण के तौर पर समझते हैं कि आखिर अल्गोरिथम कैसे कार्य करता है।

Algorithm कैसे काम करता है?

दोस्तों हम YouTube Algorithm का ही उदाहरण लेकर चलते हैं। अल्गोरिथम चाहे किसी के लिए भी तैयार किया जा रहा हो। उसमें सबसे पहले निर्देश तैयार किए जाते हैं। उन्हीं निर्देशों पर पूरा Algorithm काम करता है। अगर कुछ भी आपको एल्गोरिदम में बदलाव करने होते हैं तो आपको एल्गोरिथम की भाषा में लिखकर बदलाव करने होंगे।

अब Youtube Algorithms को ही ले लीजिए। कई बार हमने यह बात नोटिस की होगी कि यूट्यूब हमारे interest के हिसाब से अपने आप Videos हमारे सामने लाता रहता है। कोई भी व्यक्ति यूट्यूब पर वीडियो डालता है तो लोगों को यूट्यूब उस व्यक्ति की वीडियो को Recommend करता है। आपत्तिजनक वीडियो को तुरंत हटा देता है। Tranding पर अपने आप वीडियोस अपडेट हो जाती हैं। ऐसी और भी बहुत बातें हैं। जो कि यूट्यूब के एल्गोरिथम बनाने के दौरान लिखी गई है।

यूट्यूब अल्गोरिथम सब कुछ अपने आप मैनेज करता रहता है। क्योंकि यह सब बातें Algorithms Program में लिखी हुई है। ऐसे ही गूगल एल्गोरिथम,फेसबुक,ट्विटर सभी के अपने-अपने Algorithm Instructions दिए गए हैं। जो कि अपने आप काम करते रहते हैं। ठीक इसी प्रकार Algorithms काम करता है।

Algorithm की विशेषताएं (Features of Algorithm)

अल्गोरिथम कि कईं ओर भी विशेषताएं होती है। परंतु एल्गोरिथम के लिए यह पांच विशेषताएं सबसे ज्यादा महत्वपूर्ण है।जो इस प्रकार है।

Algorithm में समस्याओं को निर्देशों के जरिए हल किया जाता है। जिसमें ऐसे बहुत सी जरूरी चीजें शामिल होती हैं। जिसे आसानी से एल्गोरिथम काम करके Solve कर सके। जिन्हें “Input” कहा जाता है। कई ऐसे अल्गोरिथम भी होते हैं। जिनमें इनपुट की आवश्यकता नहीं होती। परंतु इनपुट तो मुख्यत एल्गोरिदम में होते ही हैं। एक एल्गोरिथम मे 0 या इससे ज्यादा इनपुट भी हो सकते हैं।

एल्गोरिथम जब निर्देशों की सही पालना करेगा तो उसके बाद जो परिणाम हमें प्राप्त होगा। वह आउटपुट होता है। Algorithm में एक आउटपुट तो जरूर होना चाहिए।

Definiteness

दिए गए निर्देश एकदम निश्चित होने चाहिए। किसी भी प्रकार की उलझन नहीं होनी चाहिए। सभी Step अच्छे से लिखे गए हो और आसानी से समझा जा सके। Steps को Follow करने के बाद वांछित परिणाम अवश्य आना चाहिए।

एल्गोरिथ्म के निर्देश ऐसे हैं। जिन्हें आसानी से Algo प्रोसेस कर सके। एक उचित Step-By-Step निर्देश एल्गोरिदम के होने चाहिए। ऐसे Steps लिखें। जो गिने जा सके infiniteness स्टेप ना लिखे। जिसका कोई अंत ही ना हो।

Effectiveness

जिन भी Steps यानी इंस्ट्रक्शन को आप एल्गोरिदम में लिख रहे हैं। प्रभावशाली होने चाहिए अगर आप सही निर्देशों को Algo में लिखेंगे। जाहिर सी बात है अपने आप आउटपुट यानी कि परिणाम मिलने शुरू हो जाएंगे।

  • Startup क्या है | Startup कैसे शुरू करें?
  • Samsung Members App क्या है?

एल्गोरिथ्म के प्रकार (Types of Algorithm)

एल्गोरिथ्म के छह प्रकार होते हैं जो Definition सहित इस प्रकार हैं।

Algorithm क्या है

Recursive Algorithm

Dynamic programmic algorithm, backtracking algorithm, divide and conquer algorithm, greedy algorithm.

  • Bruce Force Algorithm

इसमें समस्या को उसी समस्या के उदाहरणों के आधार पर हल किया जाता है। जब तक उचित समाधान नहीं मिल जाता। तब तक Recursive Function बार-बार काम करता है।

इसमें मान लीजिए आपके पास किसी प्रोग्राम में हुई गड़बड़ी को सही करने के जितने भी समाधान क्यों न हो इस एल्गोरिथ्म में सबसे बेहतर समाधान को चुनकर प्रॉब्लम को हल किया जाता है।

बैकट्रैकिंग सभी उचित समाधानो को बताता है। किसी पहले वाले Solution को दोबारा दौहराता नहीं है।

Algorithm में छोटे-छोटे भागों में बाँटता है। फिर किसी भी ऑपरेशन को सही तरह से करने के लिए उसे एक साथ जोड़ेगा। इसके तुरंत बाद सभी Operation को इकट्ठा कर देता है।

इसमें देखा जाता है कि कौन से ऑपरेशन को सबसे पहले Perform करना है।

Brute Force Algorithm

किसी भी Function को परफॉर्म करने के लिए कितने Combination बनाना होगा। यह सब काम Brute Force Algorithm के तहत होते है।

हमारी यह हमेशा कोशिश रहती है कि आपको हम हर जानकारी को सही तरह से समझा सके। हमें आशा है कि आप ने Algorithm के बारे में पूरी जानकारी को अच्छे से समझा होगा। अगर आपको हमारी Algorithm क्या हैपोस्ट अच्छी लगी तो हमें कमेंट करके अवश्य बताएं। आपके द्वारा किए गए कमेंट को पढ़कर हमें आपके लिए और ज्यादा Informative आर्टिकल लिखने की प्रेरणा मिलती है।

' src=

मेरा नाम Abhishek है। इस ब्लॉग का संस्थापक और लेखक हूं। मै Yoabby.com पर सभी आर्टिकल को हिंदी भाषा में लिखता हूं। मुझे लिखने का बहुत पहले से ही शौक था। ब्लॉगिंग के द्वारा मैं अपने शौक को भी पूरा कर रहा हूं। और साथ ही YoAbby.com पर आए लोगों को टेक्नोलॉजी के बारे में हिंदी भाषा में आर्टिकल उपलब्ध करवा रहा हूं।

Leave a Comment Cancel reply

Save my name, email, and website in this browser for the next time I comment.

eHindiStudy

Computer Notes in Hindi

BFS (breadth first search) in hindi

Graph traversal in hindi:-.

graph traversal का अर्थ है ग्राफ के प्रत्येक node को visit करना. यहाँ पर हम दो प्रकार के traversal की बात करेंगे. जो कि निम्नलिखित है:- 1:- BFS (breadth first search)

2:- DFS (depth first search)

1:- BFS (breadth first search) in hindi:-

BFS ग्राफ डेटा स्ट्रक्चर को travers तथा search करने की एक अल्गोरिथम है.

इसका प्रयोग ग्राफ में shortest path को ढूँढने तथा puzzle गेम्स को solve करने के लिए किया जाता है.

डेटा स्ट्रक्चर में, BFS को implement करने के लिए queue का प्रयोग किया जाता है.

BFS में nodes को breadth wise (चौड़ाई से) visit किया जाता है.

BFS में पहले किसी भी एक node को visit किया जाता है तथा उसके बाद उसके adjacent (नजदीक) के नोड्स को visit किया जाता है. इसके बाद इन adjacent नोड के भी सभी adjacent node को विजिट किया जाता है. और यह प्रक्रिया तब तक चलती है जब तक कि सभी nodes को विजिट नहीं कर लिया जाता है.

BFS algorithm:-

इसकी अल्गोरिथम को निम्नलिखित उदहारण के द्वारा समझते है. माना कि हमारे पास निम्नलिखित ग्राफ है जिसे हमें traverse करना है।

Bfs algorithm example

स्टेप 1:- queue को initialize किया जाता है.

basic algorithm problem solving in hindi

स्टेप 2: – सबसे पहले हम node A (शुरूआती नोड) को विजिट करते है और इसे visited मार्क करते है.

स्टेप 3: – इसके बाद हम A के adjacent nodes को देखते है. इसके adjacent नोड्स B, C तथा D है. इस चित्र में हम सबसे पहले B को विजिट करते है और उसे queue में रखते है.

Bfs adding B in the queue

स्टेप 4: – इसके बाद हम नोड A के adjacent node C को विजिट करते है और उसे queue में रखते है.

Adding node C in the queue

स्टेप 5:- इसके बाद A के अंतिम adjacent नोड D को विजिट करते है और उसे queue में रखते है.

Adding node D in the queue

स्टेप 6:- इसके बाद में A के कोई adjacent नोड नहीं बचे इसलिए हम B को queue से निकालते है और उसके adjacent को search करते है.

Removing B from queue

स्टेप 7:- नोड B का adjacent नोड E है तो हम E को विजिट करते है और उसे queue में रखते है.

Adding E in Queue

अब हमारे पास विजिट करने के लिए कोई भी नोड बही बचा है परन्तु हमें सभी nodes को queue से निकालना होगा. और जब queue खाली हो जायेगा तो प्रोग्राम समाप्त हो जायेगा.

निवेदन:- आपको यह पोस्ट अच्छी लगी हो तो हमें कमेंट के द्वारा बताइए तथा इसे अपने दोस्तों के साथ share करें. धन्यवाद.

11 thoughts on “BFS (breadth first search) in hindi”

primitive and non primitive data type

Welcome..keep studying

Mujhe primitive and non primitive data type chahiye

please sir mujhe depth first search k bare me notes

Plz provide-: B.T.C First semester computer notes in hindi

Ek topic pura likha kre aadha adhura n chore bad me alg jagh search karne me dikat aati h So plz plz ek topic Ko ek jagh par pura likhe THANKYOU

Sir please Give a note of all shorts with algorithms with average case wrost case and time complexity and space complexity in hindii….plz sir it’s argent..plz given in my email account

Excuse me sir mujhe shortest path algorithm k notes chahiye Hindi me.

Thank You Sir for explaining in the best way

Leave a Comment Cancel reply

Algorithm क्या है? Meaning of Algorithm in Hindi

Vivek Vaishnav

  • July 26, 2021

Algorithm क्या है? (What is algorithm in Hindi) क्या आप इस सवाल का जवाब खोज रहे हैं?

अगर हाँ, तो आप बिलकुल सही जगह पर आये हैं। इस आर्टिकल में आपको अल्गोरिथम की जानकारी मिलेगी, एल्गोरिथम क्या होता है? इसका क्या उपयोग है? कहाँ-कहाँ उपयोग होता है? एल्गोरिथम के क्या फायदे हैं और क्या नुकसान है? इन सभी सवालों के जवाब आपको मिलेंगे।

Algorithm क्या है? (What is Algorithm in Hindi?)

algorithm kya hai - what is algorithm in hindi

किसी भी समस्या का चरणबद्ध तरीके से समाधान निकालने की प्रकिया को अल्गोरिथम (Algorithm) कहते हैं। इसके जरिये हम पहले problem को छोटे-छोटे हिस्सों में बाँट कर उसे solve करते हैं।

इसे problem के solution का या किसी काम को करने का procedure या formula भी कहा जा सकता है।

चलिए इसे एक daily life example से समझते हैं:

मान कर चलिए की आप हॉट कॉफ़ी बनाना चाहते हैं, तो चलिए इसके लिए हम एक एल्गोरिथम लिखते हैं:

  • सबसे पहले गैस ऑन करें
  • उसपर बर्तन में दूध डालकर गर्म करें
  • स्वादानुसार कॉफ़ी पाउडर और चीनी डालें
  • उबलने का इंतजार करें
  • अब गैस बंद करें
  • आपकी हॉट कॉफ़ी तैयार है

इस उदाहरण से आपको algorithm क्या है और कैसे लिखा जाता है इस बारे में पता चल गया होगा।

यह बहुत ही basic example है लेकिन computer programming के क्षेत्र में लिखे जाने वाले अल्गोरिथम की बात करें तो वह बहुत जटिल होता है।

कंप्यूटर एल्गोरिथम क्या है? (Computer Algorithm meaning in Hindi)

इससे पहले साधारण भाषा में हमने एल्गोरिथम को समझा अब चलिए जानते हैं की computer algorithm क्या है?

दरअसल algorithm का उपयोग ज्यादातर computer और programming के field में किया जाता है। अगर हम कहें की आपका कंप्यूटर पूरी तरह से अल्गोरिथम के द्वारा चलता है तो इसमें कोई गलत बात नही होगी।

कंप्यूटर को किसी भी तरह के काम को करने के लिए कंप्यूटर प्रोग्राम या software की जरुरत पड़ती है। एक कंप्यूटर प्रोग्राम को प्रोग्रामिंग करके बनाया जाता है।

प्रोग्रामिंग में हमें step by step instructions लिखने होते हैं और इन्ही code के माध्यम से बताना पड़ता है की कौनसा काम कैसे करना है।

इन्ही well defined steps को algorithm कहा जाता है। इसे coding करने से पहले ही तैयार कर लिया जाता है और इसी के अनुसार कोड लिखा जाता है।

Algorithm से flow chart भी बनाया जाता है जो की पूरे process को graphical तरीके से represent करता है।

एल्गोरिथम का उपयोग क्यों करते हैं?

जैसा की हमने उपर बताया की अल्गोरिथ्म किसी भी समस्या को सुलझाने का एक step by step process है।

असल जिंदगी में भी आपने देखा होगा की यदि कोई समस्या आ जाए तो हम परेशान हो जाते हैं, कई बार हमें समझ नही आता की उस काम को complete करने के लिए कहाँ से शुरू किया जाए और क्या क्या किया जाए।

लेकिन अगर हम इसके लिए कोई step by step process बना लेते हैं तो यह काम बहुत ही आसान हो जाता है।

Algorithm के जरिये हम problem के solution को step by step तरीके से दर्शाते हैं। फिर उन steps को follow करके समस्या को सुलझा लेते हैं।

  • अल्गोरिथम का उद्देश्य किसी task को perform करके output प्राप्त करना होता है।
  • इसमें समस्या के अनुसार कई सारे निश्चित steps होते हैं।
  • जब तक ये सारे steps एक sequence में complete नही हो जाते हमें output नही मिलता है।
  • इस process के बीच में कुछ conditions भी आ सकते हैं और उसके अनुसार steps change भी हो सकते हैं लेकिन ये सभी स्टेप्स पहले तय होते हैं।

कहने का मतलब यह है की एलोरिथ्म हमें किसी काम को कैसे करना है इसकी जानकारी देता है।

Characteristics of Algorithm in Hindi

एक सही algorithm लिखने के लिए आपको कई बातों का ध्यान रखना होता है। आइये algorithm के कुछ important characteristics को समझते हैं:

  • Finiteness (निश्चितता) : आपके algorithm में हमेशा निश्चित steps होने चाहिए। एक limited steps के बाद algorithm खत्म हो जाना चाहिए।
  • Input: Problem के solution के लिए हमें कुछ न कुछ चीजों की आवश्यकता होती है जिसे हम input कहते हैं। एल्गोरिथम में 0 या उससे अधिक inputs हो सकते हैं।
  • Output: हमें steps follow करने के बाद क्या परिणाम (output) मिलेगा यह भी पहले से defined होने चाहिए।
  • Unambiguous (स्पष्ट): प्रोसेस पूरी तरह से स्पष्ट होना चाहिए। ऐसा algo जो confusion पैदा करता हो हमारा समय और अन्य resources बर्बाद कर सकता है।
  • Feasible : क्या हम जो task perform करने जा रहे हैं वह सम्भव है? क्या हमारे पास उपलब्ध data या resources से उस काम को किया जा सकता है? अगर हाँ तो आप algorithm बना सकते हैं।

Algorithm का कहाँ उपयोग होता है?

एल्गोरिथम का उपयोग mathematics, science, कंप्यूटर प्रोग्रामिंग , Artificial Intelligent, medical जैसे क्षेत्रों में अधिक होता है इसे daily life में भी उपयोग कर सकते हैं।

हम अपनी हर रोज कुछ न कुछ ऐसा काम करते हैं जिसमे algorithm का उपयोग होता है लेकिन हमें उस बारे में जानकारी नही होती।

तो चलिए आज ऐसे ही रोजमर्रा के कुछ कामो के बारे में जानते हैं जहाँ अल्गोरिथम का उपयोग होता है:

Facebook Algorithm:

आप फेसबुक हर रोज चलाते हैं, क्या आपने कभी सोचा है की क्यों कोई post viral हो जाता है जबकि कुछ पोस्ट पर लोगों के likes ही नही मिलते?

दरअसल इस काम के पीछे एक जटिल एल्गोरिथम है जो की सिर्फ उन्ही पोस्ट को viral होने देता है जिसे लोग पसंद करते हैं। सिर्फ यही नही इसके अलावा फेसबुक हर काम के लिए algo का उपयोग करता है।

केवल फेसबुक ही नही बल्कि सारे social media platforms algorithm का उपयोग करते हैं।

Google Search Algorithm:

इन्टरनेट पर करोड़ों कि संख्या में वेबसाइट हैं लेकिन गूगल पर कुछ सर्च किया जाए तो SERP (Search Engine Result Page) पर केवल top के sites ही दिखाई देते हैं ऐसा क्यों?

दरअसल गूगल जैसे सर्च इंजन websites को उनकी quality के आधार rank करते हैं और अच्छी sites को पहले पेज पर दिखाते हैं। इस काम के लिए ranking algorithms का उपयोग किया जाता है।

  • Search Engine Optimization (SEO) क्या है?

Operating Systems Algorithm:

आपके कंप्यूटर, स्मार्टफोन आदि में जो ऑपरेटिंग सिस्टम होते हैं और ये system के सारे task को manage करते हैं। ये इतने अच्छे से इसलिए काम कर पाते हैं क्योंकि इनके काम करने का तरीका algorithm आधारित होते है।

आपके computer system पर एक ही समय में कई सारे tasks चलते रहते हैं, OS के scheduling algorithm इन सभी tasks को उनकी priority के आधार process करता है।

ये कुछ basic examples हैं, algorithm कहाँ-कहाँ उपयोग होता है यह बता पाना काफी मुश्किल काम है क्योकि इसका उपयोग कई सारी जगहों पर किया जाता है।

एल्गोरिथम के क्या फायदे हैं? (Advantages of Algorithm in Hindi)

  • Algorithm किसी भी problem के solution को छोटे-छोटे parts में divide कर देता है जिससे समझने में आसानी होती है।
  • Step by step solution provide करता है जिससे यह clarity बढ़ जाती है।
  • Task को complete करने के लिए हमें किन-किन चीजों की जरुरत है यह पहले ही तय हो जाता है।
  • Decision making को आसान बनाता है।
  • एल्गोरिथम बनने के बाद इसके अनुसार किसी भी programming language में code लिखा जा सकता है।

एल्गोरिथम के नुकसान (Disadvantages of Algorithm in Hindi)

  • Algorithm बनाने में काफी समय लगता है यह time consuming काम है।
  • Looping और branching को दर्शाना काफी मुश्किल है।
  • बड़े प्रोजेक्ट के लिए अल्गोरिथम बनाने में काफी मेहनत लगती है।

Algorithm कैसे बनाया जाता है? (Examples of Algorithm in Programming)

एल्गोरिथम कैसे बनाया जाता है इसे समझने के लिए हम algorithm के कुछ basic example को देखते हैं:

Example 1: Write an algorithm to add two numbers entered by the user. (यूजर द्वारा इंटर किये गये दो नंबरों को जोड़ना)

Step 1: Start

Step 2: Declare variables num1, num2 and result.

Step 3: Read values num1 and num2.

Step 4: Add num1 and num2 and assign the result to result.

Step 5: Display result Step 6: Stop

Example 2: Write an algorithm to find the largest of three given numbers. (तीन नंबरों में से सबसे बड़ी संख्या का पता लगायें)

Step 2: Declare variables a,b and c.

Step 3: Read variables a,b and c.

Step 4: If a>b

Display “a is the largest number”.

Display “c is the largest number”.

Display “b is the largest number”.

Display “c is the greatest number”.

Step 5: Stop

उपर दिए गये उदाहरण की तरह ही अलग-अलग field में अलग-अलग task को perform करने और समस्याओं को सुलझाने के लिए algorithm लिखा जाता है।

इसे लिखने के बाद लगभग सारी चीजें clear हो जाती हैं फिर इसे किसी भी प्रोग्रामिंग लैंग्वेज में coding करके implement कर लिया जाता है।

Conclusion – Algorithm क्या है? Meaning of Algorithm in Hindi

Technology की दुनिया में एल्गोरिथम का उपयोग बहुत ही ज्यादा होता है। सोशल मीडिया साइट्स से लेकर सर्च इंजन तक हर बड़े वेबसाइट में logical task को perform करने और decision making के लिए इसका उपयोग किया जा रहा है।आजकल AI यानी Artificial Intelligence का ज़माना है और बिना algorithm के इसके बारे में सोचना भी मुश्किल है।

  • Scripting Language क्या है? स्क्रिप्टिंग और प्रोग्रामिंग में क्या अंतर है?
  • VPN क्या है? इसके फायदे नुकसान और उपयोग की पूरी जानकारी
  • एन्क्रिप्शन क्या है? Meaning of Encryption in Hindi

उम्मीद है आपको इस आर्टिकल की मदद से Algorithm क्या है? (What is algorithm in Hindi) समझ आ गया होगा। अगर पसंद आये तो आप इस जानकारी को अपने दोस्तों के साथ सोशल मीडिया पर साझा कर सकते हैं।

जानकारी कैसी लगी? अपने दोस्तों के साथ शेयर जरुर करें

  • Click to share on WhatsApp (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on Pinterest (Opens in new window)

Vivek Vaishnav

Vivek Vaishnav

नमस्कार, मैं विवेक, WebInHindi का founder हूँ। इस ब्लॉग से आप वेब डिजाईन, वेब डेवलपमेंट, Blogging से जुड़े जानकारियां और tutorials प्राप्त कर सकते हैं। अगर आपको हमारा यह ब्लॉग पसंद आये तो आप हमें social media पर follow कर हमारा सहयोग कर सकते हैं|

Bahut hi behtrin trike se smjhaya,sbse bdi baat ek hi chij repeat nhi ki gai …..Plz visit my site also!

Leave a Reply Cancel Reply

Your email address will not be published. Required fields are marked *

Name  *

Email  *

Add Comment  *

Save my name, email, and website in this browser for the next time I comment.

Notify me of follow-up comments by email.

Notify me of new posts by email.

Post Comment

ItPolyNotes

Information Technology & Computer Science Hindi Notes

Analysis of algorithm in Hindi

Hello दोस्तों! आज मैं आपको इस पोस्ट में Analysis of algorithm in Hindi के बारें में बताऊंगा, और इसके example को भी पढेंगे, तो चलिए शुरू करते हैं:-

Analysis of algorithm:-

कोई भी program data structure तथा algorithm दोनों का combination होता है

algorithm किसी भी specific problem को solve करने के लिए विभिन्न steps का combination होता है

algorithm को किसी भी problem को read करने व उसकी solution को define करने के लिए use मे लिया जाता है

यह operation जिन्हे perform किया जायेगा साथ ही example के साथ उस problem के solution को contain करता है

algorithm के द्वारा time और space complexity को check किया जाता है algorithm के complexity function होती है

जो run time या input size को consider करती है।

निवेदन:- अगर आपके लिए यह आर्टिकल useful रहा हो तो इसे अपने दोस्तों और classmates के साथ अवश्य share कीजिये, या अन्य विषयों से related कोई question हो तो नीचे कमेंट के द्वारा बताइए. thanks.

Leave a Comment Cancel reply

Chapter: Introduction to the Design and Analysis of Algorithms

Fundamentals of Algorithmic Problem Solving

Let us start by reiterating an important point made in the introduction to this chapter:

We can consider algorithms to be procedural solutions to problems.

These solutions are not answers but specific instructions for getting answers. It is this emphasis on precisely defined constructive procedures that makes computer science distinct from other disciplines. In particular, this distinguishes it from the-oretical mathematics, whose practitioners are typically satisfied with just proving the existence of a solution to a problem and, possibly, investigating the solution’s properties.

We now list and briefly discuss a sequence of steps one typically goes through in designing and analyzing an algorithm (Figure 1.2).

Understanding the Problem

From a practical perspective, the first thing you need to do before designing an algorithm is to understand completely the problem given. Read the problem’s description carefully and ask questions if you have any doubts about the problem, do a few small examples by hand, think about special cases, and ask questions again if needed.

There are a few types of problems that arise in computing applications quite often. We review them in the next section. If the problem in question is one of them, you might be able to use a known algorithm for solving it. Of course, it helps to understand how such an algorithm works and to know its strengths and weaknesses, especially if you have to choose among several available algorithms. But often you will not find a readily available algorithm and will have to design your own. The sequence of steps outlined in this section should help you in this exciting but not always easy task.

An input to an algorithm specifies an instance of the problem the algorithm solves. It is very important to specify exactly the set of instances the algorithm needs to handle. (As an example, recall the variations in the set of instances for the three greatest common divisor algorithms discussed in the previous section.) If you fail to do this, your algorithm may work correctly for a majority of inputs but crash on some “boundary” value. Remember that a correct algorithm is not one that works most of the time, but one that works correctly for all legitimate inputs.

Do not skimp on this first step of the algorithmic problem-solving process; otherwise, you will run the risk of unnecessary rework.

Ascertaining the Capabilities of the Computational Device

Once you completely understand a problem, you need to ascertain the capabilities of the computational device the algorithm is intended for. The vast majority of 

basic algorithm problem solving in hindi

algorithms in use today are still destined to be programmed for a computer closely resembling the von Neumann machine—a computer architecture outlined by the prominent Hungarian-American mathematician John von Neumann (1903– 1957), in collaboration with A. Burks and H. Goldstine, in 1946. The essence of this architecture is captured by the so-called random-access machine ( RAM ). Its central assumption is that instructions are executed one after another, one operation at a time. Accordingly, algorithms designed to be executed on such machines are called sequential algorithms .

The central assumption of the RAM model does not hold for some newer computers that can execute operations concurrently, i.e., in parallel. Algorithms that take advantage of this capability are called parallel algorithms . Still, studying the classic techniques for design and analysis of algorithms under the RAM model remains the cornerstone of algorithmics for the foreseeable future.

Should you worry about the speed and amount of memory of a computer at your disposal? If you are designing an algorithm as a scientific exercise, the answer is a qualified no. As you will see in Section 2.1, most computer scientists prefer to study algorithms in terms independent of specification parameters for a particular computer. If you are designing an algorithm as a practical tool, the answer may depend on a problem you need to solve. Even the “slow” computers of today are almost unimaginably fast. Consequently, in many situations you need not worry about a computer being too slow for the task. There are important problems, however, that are very complex by their nature, or have to process huge volumes of data, or deal with applications where the time is critical. In such situations, it is imperative to be aware of the speed and memory available on a particular computer system.

Choosing between Exact and Approximate Problem Solving

The next principal decision is to choose between solving the problem exactly or solving it approximately. In the former case, an algorithm is called an exact algo-rithm ; in the latter case, an algorithm is called an approximation algorithm . Why would one opt for an approximation algorithm? First, there are important prob-lems that simply cannot be solved exactly for most of their instances; examples include extracting square roots, solving nonlinear equations, and evaluating def-inite integrals. Second, available algorithms for solving a problem exactly can be unacceptably slow because of the problem’s intrinsic complexity. This happens, in particular, for many problems involving a very large number of choices; you will see examples of such difficult problems in Chapters 3, 11, and 12. Third, an ap-proximation algorithm can be a part of a more sophisticated algorithm that solves a problem exactly.

Algorithm Design Techniques

Now, with all the components of the algorithmic problem solving in place, how do you design an algorithm to solve a given problem? This is the main question this book seeks to answer by teaching you several general design techniques.

What is an algorithm design technique?

An algorithm design technique (or “strategy” or “paradigm”) is a general approach to solving problems algorithmically that is applicable to a variety of problems from different areas of computing.

Check this book’s table of contents and you will see that a majority of its chapters are devoted to individual design techniques. They distill a few key ideas that have proven to be useful in designing algorithms. Learning these techniques is of utmost importance for the following reasons.

First, they provide guidance for designing algorithms for new problems, i.e., problems for which there is no known satisfactory algorithm. Therefore—to use the language of a famous proverb—learning such techniques is akin to learning to fish as opposed to being given a fish caught by somebody else. It is not true, of course, that each of these general techniques will be necessarily applicable to every problem you may encounter. But taken together, they do constitute a powerful collection of tools that you will find quite handy in your studies and work.

Second, algorithms are the cornerstone of computer science. Every science is interested in classifying its principal subject, and computer science is no exception. Algorithm design techniques make it possible to classify algorithms according to an underlying design idea; therefore, they can serve as a natural way to both categorize and study algorithms.

Designing an Algorithm and Data Structures

While the algorithm design techniques do provide a powerful set of general ap-proaches to algorithmic problem solving, designing an algorithm for a particular problem may still be a challenging task. Some design techniques can be simply inapplicable to the problem in question. Sometimes, several techniques need to be combined, and there are algorithms that are hard to pinpoint as applications of the known design techniques. Even when a particular design technique is ap-plicable, getting an algorithm often requires a nontrivial ingenuity on the part of the algorithm designer. With practice, both tasks—choosing among the general techniques and applying them—get easier, but they are rarely easy.

Of course, one should pay close attention to choosing data structures appro-priate for the operations performed by the algorithm. For example, the sieve of Eratosthenes introduced in Section 1.1 would run longer if we used a linked list instead of an array in its implementation (why?). Also note that some of the al-gorithm design techniques discussed in Chapters 6 and 7 depend intimately on structuring or restructuring data specifying a problem’s instance. Many years ago, an influential textbook proclaimed the fundamental importance of both algo-rithms and data structures for computer programming by its very title: Algorithms + Data Structures = Programs [Wir76]. In the new world of object-oriented programming, data structures remain crucially important for both design and analysis of algorithms. We review basic data structures in Section 1.4.

Methods of Specifying an Algorithm

Once you have designed an algorithm, you need to specify it in some fashion. In Section 1.1, to give you an example, Euclid’s algorithm is described in words (in a free and also a step-by-step form) and in pseudocode. These are the two options that are most widely used nowadays for specifying algorithms.

Using a natural language has an obvious appeal; however, the inherent ambi-guity of any natural language makes a succinct and clear description of algorithms surprisingly difficult. Nevertheless, being able to do this is an important skill that you should strive to develop in the process of learning algorithms.

Pseudocode is a mixture of a natural language and programming language-like constructs. Pseudocode is usually more precise than natural language, and its usage often yields more succinct algorithm descriptions. Surprisingly, computer scientists have never agreed on a single form of pseudocode, leaving textbook authors with a need to design their own “dialects.” Fortunately, these dialects are so close to each other that anyone familiar with a modern programming language should be able to understand them all.

This book’s dialect was selected to cause minimal difficulty for a reader. For the sake of simplicity, we omit declarations of variables and use indentation to show the scope of such statements as for , if , and while . As you saw in the previous section, we use an arrow “ ← ” for the assignment operation and two slashes “ // ” for comments.

In the earlier days of computing, the dominant vehicle for specifying algo-rithms was a flowchart , a method of expressing an algorithm by a collection of connected geometric shapes containing descriptions of the algorithm’s steps. This representation technique has proved to be inconvenient for all but very simple algorithms; nowadays, it can be found only in old algorithm books.

The state of the art of computing has not yet reached a point where an algorithm’s description—be it in a natural language or pseudocode—can be fed into an electronic computer directly. Instead, it needs to be converted into a computer program written in a particular computer language. We can look at such a program as yet another way of specifying the algorithm, although it is preferable to consider it as the algorithm’s implementation.

Proving an Algorithm’s Correctness

Once an algorithm has been specified, you have to prove its correctness . That is, you have to prove that the algorithm yields a required result for every legitimate input in a finite amount of time. For example, the correctness of Euclid’s algorithm for computing the greatest common divisor stems from the correctness of the equality gcd (m, n) = gcd (n, m mod n) (which, in turn, needs a proof; see Problem 7 in Exercises 1.1), the simple observation that the second integer gets smaller on every iteration of the algorithm, and the fact that the algorithm stops when the second integer becomes 0.

For some algorithms, a proof of correctness is quite easy; for others, it can be quite complex. A common technique for proving correctness is to use mathemati-cal induction because an algorithm’s iterations provide a natural sequence of steps needed for such proofs. It might be worth mentioning that although tracing the algorithm’s performance for a few specific inputs can be a very worthwhile activ-ity, it cannot prove the algorithm’s correctness conclusively. But in order to show that an algorithm is incorrect, you need just one instance of its input for which the algorithm fails.

The notion of correctness for approximation algorithms is less straightforward than it is for exact algorithms. For an approximation algorithm, we usually would like to be able to show that the error produced by the algorithm does not exceed a predefined limit. You can find examples of such investigations in Chapter 12.

Analyzing an Algorithm

We usually want our algorithms to possess several qualities. After correctness, by far the most important is efficiency . In fact, there are two kinds of algorithm efficiency: time efficiency , indicating how fast the algorithm runs, and space ef-ficiency , indicating how much extra memory it uses. A general framework and specific techniques for analyzing an algorithm’s efficiency appear in Chapter 2.

Another desirable characteristic of an algorithm is simplicity . Unlike effi-ciency, which can be precisely defined and investigated with mathematical rigor, simplicity, like beauty, is to a considerable degree in the eye of the beholder. For example, most people would agree that Euclid’s algorithm is simpler than the middle-school procedure for computing gcd (m, n) , but it is not clear whether Eu-clid’s algorithm is simpler than the consecutive integer checking algorithm. Still, simplicity is an important algorithm characteristic to strive for. Why? Because sim-pler algorithms are easier to understand and easier to program; consequently, the resulting programs usually contain fewer bugs. There is also the undeniable aes-thetic appeal of simplicity. Sometimes simpler algorithms are also more efficient than more complicated alternatives. Unfortunately, it is not always true, in which case a judicious compromise needs to be made.

Yet another desirable characteristic of an algorithm is generality . There are, in fact, two issues here: generality of the problem the algorithm solves and the set of inputs it accepts. On the first issue, note that it is sometimes easier to design an algorithm for a problem posed in more general terms. Consider, for example, the problem of determining whether two integers are relatively prime, i.e., whether their only common divisor is equal to 1. It is easier to design an algorithm for a more general problem of computing the greatest common divisor of two integers and, to solve the former problem, check whether the gcd is 1 or not. There are situations, however, where designing a more general algorithm is unnecessary or difficult or even impossible. For example, it is unnecessary to sort a list of n numbers to find its median, which is its n/ 2 th smallest element. To give another example, the standard formula for roots of a quadratic equation cannot be generalized to handle polynomials of arbitrary degrees.

As to the set of inputs, your main concern should be designing an algorithm that can handle a set of inputs that is natural for the problem at hand. For example, excluding integers equal to 1 as possible inputs for a greatest common divisor algorithm would be quite unnatural. On the other hand, although the standard formula for the roots of a quadratic equation holds for complex coefficients, we would normally not implement it on this level of generality unless this capability is explicitly required.

If you are not satisfied with the algorithm’s efficiency, simplicity, or generality, you must return to the drawing board and redesign the algorithm. In fact, even if your evaluation is positive, it is still worth searching for other algorithmic solutions. Recall the three different algorithms in the previous section for computing the greatest common divisor: generally, you should not expect to get the best algorithm on the first try. At the very least, you should try to fine-tune the algorithm you already have. For example, we made several improvements in our implementation of the sieve of Eratosthenes compared with its initial outline in Section 1.1. (Can you identify them?) You will do well if you keep in mind the following observation of Antoine de Saint-Exupery,´ the French writer, pilot, and aircraft designer: “A designer knows he has arrived at perfection not when there is no longer anything to add, but when there is no longer anything to take away.” 1

Coding an Algorithm

  Most algorithms are destined to be ultimately implemented as computer pro-grams. Programming an algorithm presents both a peril and an opportunity. The peril lies in the possibility of making the transition from an algorithm to a pro-gram either incorrectly or very inefficiently. Some influential computer scientists strongly believe that unless the correctness of a computer program is proven with full mathematical rigor, the program cannot be considered correct. They have developed special techniques for doing such proofs (see [Gri81]), but the power of these techniques of formal verification is limited so far to very small programs.

As a practical matter, the validity of programs is still established by testing. Testing of computer programs is an art rather than a science, but that does not mean that there is nothing in it to learn. Look up books devoted to testing and debugging; even more important, test and debug your program thoroughly whenever you implement an algorithm.

Also note that throughout the book, we assume that inputs to algorithms belong to the specified sets and hence require no verification. When implementing algorithms as programs to be used in actual applications, you should provide such verifications.

Of course, implementing an algorithm correctly is necessary but not sufficient: you would not like to diminish your algorithm’s power by an inefficient implemen-tation. Modern compilers do provide a certain safety net in this regard, especially when they are used in their code optimization mode. Still, you need to be aware of such standard tricks as computing a loop’s invariant (an expression that does not change its value) outside the loop, collecting common subexpressions, replac-ing expensive operations by cheap ones, and so on. (See [Ker99] and [Ben00] for a good discussion of code tuning and other issues related to algorithm program-ming.) Typically, such improvements can speed up a program only by a constant factor, whereas a better algorithm can make a difference in running time by orders of magnitude. But once an algorithm is selected, a 10–50% speedup may be worth an effort.

A working program provides an additional opportunity in allowing an em-pirical analysis of the underlying algorithm. Such an analysis is based on timing the program on several inputs and then analyzing the results obtained. We dis-cuss the advantages and disadvantages of this approach to analyzing algorithms in Section 2.6.

In conclusion, let us emphasize again the main lesson of the process depicted in Figure 1.2:

As a rule, a good algorithm is a result of repeated effort and rework.

Even if you have been fortunate enough to get an algorithmic idea that seems perfect, you should still try to see whether it can be improved.

Actually, this is good news since it makes the ultimate result so much more enjoyable. (Yes, I did think of naming this book The Joy of Algorithms .) On the other hand, how does one know when to stop? In the real world, more often than not a project’s schedule or the impatience of your boss will stop you. And so it should be: perfection is expensive and in fact not always called for. Designing an algorithm is an engineering-like activity that calls for compromises among competing goals under the constraints of available resources, with the designer’s time being one of the resources.

In the academic world, the question leads to an interesting but usually difficult investigation of an algorithm’s optimality . Actually, this question is not about the efficiency of an algorithm but about the complexity of the problem it solves: What is the minimum amount of effort any algorithm will need to exert to solve the problem? For some problems, the answer to this question is known. For example, any algorithm that sorts an array by comparing values of its elements needs about n log 2 n comparisons for some arrays of size n (see Section 11.2). But for many seemingly easy problems such as integer multiplication, computer scientists do not yet have a final answer.

Another important issue of algorithmic problem solving is the question of whether or not every problem can be solved by an algorithm. We are not talking here about problems that do not have a solution, such as finding real roots of a quadratic equation with a negative discriminant. For such cases, an output indicating that the problem does not have a solution is all we can and should expect from an algorithm. Nor are we talking about ambiguously stated problems. Even some unambiguous problems that must have a simple yes or no answer are “undecidable,” i.e., unsolvable by any algorithm. An important example of such a problem appears in Section 11.3. Fortunately, a vast majority of problems in practical computing can be solved by an algorithm.

Before leaving this section, let us be sure that you do not have the misconception—possibly caused by the somewhat mechanical nature of the diagram of Figure 1.2—that designing an algorithm is a dull activity. There is nothing further from the truth: inventing (or discovering?) algorithms is a very creative and rewarding process. This book is designed to convince you that this is the case.

Exercises 1.2

             Old World puzzle A peasant finds himself on a riverbank with a wolf, a goat, and a head of cabbage. He needs to transport all three to the other side of the river in his boat. However, the boat has room for only the peasant himself and one other item (either the wolf, the goat, or the cabbage). In his absence, the wolf would eat the goat, and the goat would eat the cabbage. Solve this problem for the peasant or prove it has no solution. (Note: The peasant is a vegetarian but does not like cabbage and hence can eat neither the goat nor the cabbage to help him solve the problem. And it goes without saying that the wolf is a protected species.)

            New World puzzle There are four people who want to cross a rickety bridge; they all begin on the same side. You have 17 minutes to get them all across to the other side. It is night, and they have one flashlight. A maximum of two people can cross the bridge at one time. Any party that crosses, either one or two people, must have the flashlight with them. The flashlight must be walked back and forth; it cannot be thrown, for example. Person 1 takes 1 minute to cross the bridge, person 2 takes 2 minutes, person 3 takes 5 minutes, and person 4 takes 10 minutes. A pair must walk together at the rate of the slower person’s pace. (Note: According to a rumor on the Internet, interviewers at a well-known software company located near Seattle have given this problem to interviewees.)

            Which of the following formulas can be considered an algorithm for comput-ing the area of a triangle whose side lengths are given positive numbers a , b , and c ?

basic algorithm problem solving in hindi

            Write pseudocode for an algorithm for finding real roots of equation ax 2 + bx + c = 0 for arbitrary real coefficients a, b, and c. (You may assume the availability of the square root function sqrt (x). )

            Describe the standard algorithm for finding the binary representation of a positive decimal integer

                     in English.

                     in pseudocode.

            Describe the algorithm used by your favorite ATM machine in dispensing cash. (You may give your description in either English or pseudocode, which-ever you find more convenient.)

            a.  Can the problem of computing the number π be solved exactly?

                     How many instances does this problem have?

Look up an algorithm for this problem on the Internet.

                                                                    Give an example of a problem other than computing the greatest common divisor for which you know more than one algorithm. Which of them is simpler? Which is more efficient?

                                                                    Consider the following algorithm for finding the distance between the two closest elements in an array of numbers.

ALGORITHM                       MinDistance (A [0 ..n − 1] )

//Input: Array A [0 ..n − 1] of numbers

//Output: Minimum distance between two of its elements dmin ← ∞

for i ← 0 to n − 1 do

for j ← 0 to n − 1 do

if i  = j and |A[i] − A[j ]| < dmin dmin ← |A[i] − A[j ]|

return dmin

Make as many improvements as you can in this algorithmic solution to the problem. If you need to, you may change the algorithm altogether; if not, improve the implementation given.

One of the most influential books on problem solving, titled How To Solve It [Pol57], was written by the Hungarian-American mathematician George Polya´ (1887–1985). Polya´ summarized his ideas in a four-point summary. Find this summary on the Internet or, better yet, in his book, and compare it with the plan outlined in Section 1.2. What do they have in common? How are they different?

Related Topics

Privacy Policy , Terms and Conditions , DMCA Policy and Compliant

Copyright © 2018-2024 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.

DEV Community

DEV Community

Posted on Sep 17, 2019 • Updated on Jun 25, 2022

Programming Algorithms 20+ basic Algorithms Problems from Coding Interviews

basic algorithm problem solving in hindi

Hello All, If you are preparing for Programming job interviews or looking for a new job then you know that it's not an easy process. You got to be lucky to get the call and make to the first round of interview, not just when you are a beginner but at any stage of your career.

But, Yes, it is the most difficult at the beginner level when you are searching for your first job.

That's why you can't just take your chance lightly. You got to be prepared to grab that chance and for that, you must know that is expected from you on the interview. What is asked, what topics should you prepare, etc?

I have blogged a lot about what you can find helpful articles in this blog but to recap let me tell you that apart from data structure questions , System Design Questions , and Programming language specific questions like Java , C++ , or Scala , most of the programming job interviews also ask algorithm based questions.

These are based upon common searching and sorting algorithms like String algorithms , binary search , graph algorithms , etc.

It's important that you practice these Algorithms based questions because even though they seem obvious and easy, sometimes they become tricky to solve in the actual interview, especially if you have never coded them by yourself.

Practising these problems before interview not only makes you familiar with them but also gives you more confidence in explaining the solution to the interviewer, which plays a very important role in your selection.

It also makes you ready for any twisted questions and alternative problems like Interviewers often like to ask you to solve a particular coding problem using Recursion or Iteration .

Sometime, if you use a data structure like the one I have used in finding duplicate characters on String , they will ask you to solve that problem without using the Set data structure. That's just some common example and that's why practice matters a lot.

Btw, if you are a complete beginner in the world of Data Structure and Algorithms, then I suggest you to first go through a comprehensive Algorithm course like Data Structures and Algorithms: Deep Dive Using Java on Udemy which will not only teach you basic data structure and algorithms but also how to use them on the real world and how to solve coding problems using them.

On the other hand, if you like to read books or prefer books over online courses then you must read a comprehensive book like Introduction to Algorithms by Thomas H. Cormen to get an understanding of common Computer Science Algorithms like Searching, Sorting, Cryptography, Graph Algorithms and some common ones like Fourier Transform.

Top 20 basic Algorithms interview questions for Programmers

Anyway, here is some of the frequently asked Searching and Sorting Algorithms questions from Interviews. I have linked the solution but you should try to solve the problem before looking at the solution.

The purpose of this article is that you should know how to solve these problems on your own, but, yes, if you got stuck and want to compare your solution, you can see the solution.

1. Can you implement a Binary Search Algorithm? ( solution ) It's easy, binary search is a divide and conquers algorithm, where the problem is divided into sub-problem and those are solved. It's a search algorithm which means it is used to find things like a number in an integer array or an item in a catalog.

The easiest way to implement a binary search algorithm is by using Recursion, which is what the solution link contains but you should try it yourself before seeing the solution.

One of the worth noting this is that the input must be sorted, I mean you can only implement binary search in a sorted array .

2. Write a program to implement Linear search Algorithm? ( solution ) It is even easier than binary search, all you need to do is go through all elements in the array using a for loop or recursive method and compare each element with the one you want to search. when an element matches you either return index or true/false depending upon your requirement.

For example, if you are writing a contains() method you can return true or false to indicate whether an element is present in the array or not. Since you need to scan the whole array to find the element, the time complexity of this algorithm is O(n) .

Btw, if you have trouble calculating and understanding time and space complexity of algorithms then you should see a course like Data Structures & Algorithms --- Interview to understand them better before going for an interview.

3. Can you implement a Binary search Algorithm without recursion? ( solution ) You might know that you can replace a recursive algorithm to an iterative one by using a loop and sometimes using a Stack data structure. For binary search also you can do this, just divide the array and compare the middle element until you find the target element or there is no more element into an array.

If the target element is greater than middle than you got to move towards the right, or otherwise towards left.

Btw, if you have trouble understanding recursive algorithm or converting a recursive one to iterative one then I suggest you go through a good online course like Algorithms and Data Structures --- Part 1 and Part 2 in Pluralsight to learn fundamentals better.

These courses will also teach you about how to calculate time and space complexity which is very important from both Coding Interview perspective as well as improving the performance of an Algorithm.

basic algorithm problem solving in hindi

4. Implement the Bubble sort Algorithm? ( solution ) Isn't this was the first sorting algorithm you learn? Well, I did and that's why I remember that bubble sort is about comparing each number with every other number in an array so that after each pass the largest or smallest element bubble up to the top.

I mean the number has found it's placed in the sorting order. This is one of the fundamental sorting algorithms and most of us started learning about sorting using this algorithm.

The time complexity of this is O(n ^2) which makes it unusable for a large set of numbers but it does well for a small set of numbers.

5. Write Code to implement Level Order Search in a Binary Tree? (solution) In level order search you first visit sibling nodes than going down into the next level. You can use a Queue to implement level order search in a binary tree.If you want to learn more, you can check any of these free data structure and algorithms courses on freeCodeCamp

And, if you are really serious about doing well, you can also check this list of courses to crack your programming job interviews

6. Difference between a stable and unstable sorting algorithm? ( answer ) This one was a tricky concept which I didn't know until long ago. I haven't come across any practical use case of this one yet but just knowing the concept is Ok from the interview perspective.

In a stable sorting algorithm, the order of the same element remains the same even after sorting but during the unstable sorting algorithm, this changes.

A good example is a quicksort and mergesort where former is unstable while later is a stable algorithm.

7. What is Depth First Search Algorithm for a binary tree? (solution) It's another popular searching algorithm which is mainly used in tree and graphs. This algorithm first visits nodes in depth before searching in the same level, that's why the name Depth-first search algorithm.

It's tricky to implement but you can use a Stack to implement DFS or Depth-first search algorithm. If you need more information on this topic, I suggest you check the Grokking Algorithms book by Aditya Bhargava, his explanation is probably the best explanation of this topic

basic algorithm problem solving in hindi

8. How is an iterative quicksort algorithm implemented? ( solution ) Obviously without recursion:-). If you remember, I have told you before that you can use a Stack to convert a recursive algorithm into an iterative one and that's what you can do as well to implement Quicksort algorithm without recursion. You can further see the solution if you need more help with respect to implementation.

9. How do you implement a counting sort algorithm? ( solution ) Just like we have done with other O(n) sorting algorithms like Radix sort and Bucket sort.

If you don't know Counting sort is another integer sorting algorithm for sorting a collection of objects according to keys that are small integers.

It has O(n) time complexity which makes it faster than likes of Quicksort and Mergesort for a particular set of input. See the solution for more details.

10. How do you swap two numbers without using the third variable? ( solution ) Another tricky question which is easy if you know the trick :-) Well you can swap two numbers without using a temporary or third variable if you can store the sum of numbers in one number and then minus the sum with other number something like

a = 3;\ b = 5;

a = a + b; //8\ b = a --- b; // 3\ a = a --- b; //5

now you have a = 5 and b = 3, so numbers are swapped without using a third or temp variable.

11. How is a radix sort algorithm implemented? ( solution ) This is another integer sorting algorithm with O(n) time complexity. As per Wikipedia, Radix sort is a non-comparative sorting algorithm that sorts data with integer keys by grouping keys by the individual digits which share the same significant position and value.

You can further see Algorithms, Part I and Algorithms Part II by Robert Sedgewick on [Coursera] to learn more about these O(n) or liner sorting algorithms. The course is free for learning and exploring but you need to pay if you also want a certification.

data structure and algorithms interview questions answers

By the way, If you are planning to join multiple Coursera courses or specializations, then consider taking a Coursera Plus subscription which provides you unlimited access to their most popular courses, specialization, professional certificate, and guided projects.

12. How do you implement an insertion sort algorithm? ( solution ) Have you ever arranged the deck of cards, or maybe shirts in your cupboard? What is common between those two things? Well, you put the next card or shirt into their proper position, or, should I say you insert the next element in its proper position. That's the insertion sort for you.

13. Write Algorithm to check if two rectangles overlap with each other? ( solution ) This is a tricky Algorithm question but if you have to listen to your teacher in your 2D Maths class then you can solve this problem. There is another trick, check for all the conditions when rectangle will not overlap and if any condition is false it means both rectangles are overlapping with each other. For example, if the upper side of one rectangle is below the lower side of other rectangles then they won't overlap as they are vertically aligned.

14. How is a merge sort algorithm implemented? ( solution ) Similar to Quicksort, merge sort is also a divide and conquer algorithm which means you keep divides the problem until you can sort the smallest of them.

For example to sort an array of numbers you divide the array into smaller parts until you know how to sort them like an array with one or zero elements is already sorted. Once you sort small arrays you merge them to get the final result.

The only difference between Quicksort and Mergesort is that mergesort is stable while Quicksort is not-stable . This means equal elements retain their spot before and after sorting.

Another worth noting difference is that even though both have O(NLogN) average time, it's better to use quicksort than mergesort because Quicksort takes less time for the same number of input, the constant factor is less in Quicksort than merge sort.

basic algorithm problem solving in hindi

15. How do you implement a bucket sort algorithm? ( solution ) The Bucket sort is another awesome algorithm which can sort an array without even comparing elements.

It's known as non-comparison sorting algorithm and can give O(n) performance for the selected input.

If you don't know about the non-comparison based sorting Algorithm, please see Introduction to Algorithms book.

basic algorithm problem solving in hindi

16. Write Algorithms to Check if Two String are Anagram ( Solution ) An anagram is something where length and character matches but not the order like Army and Mary , both have the same number of characters.

One trick is to solve this problem is to sort the character array and check if they are the same or not.

17. Implement the QuickSort Algorithm in your Favorite Programing language? ( solution ) This one is a very easy sorting algorithm, but only if you have practiced, if not then you may lose your way. Remember, Quicksort is a divide and conquer algorithm which means you keep dividing array, also known as partitioning . Then you solve the problem at the smallest level, also known as a base case like when your array contains just one or zero elements.

19, Difference between Comparison and Non-Comparison Sorting Algorithms? ( answer ) As the name suggests, in comparison based sorting algorithms you must compare elements to sort like quicksort, but in non-comparison based sorting algorithm like Counting sort , you can sort elements without comparing it. Surprised?

Well yes, then I suggest you check out this course to learn more about O(n) sorting algorithms like Radix Sort, Counting Sort, and Bucket Sort. You can further see Data Structures and Algorithms: Deep Dive if you want to learn more about these O(n) sorting algorithms.

19. How to check if two String is rotations of each other? ( solution ) There is a simple trick to solve this problem, just concatenate the String with itself and check if the rotation exists there. You can do that by using indexOf or substring method. If the concatenated String contains rotation then given String is a rotation of former.* \ *

20. Implement Sieve of Eratosthenes Algorithms for Prime Number? ( solution ) This is one of the tough algorithms to implement especially if you don't remember it :-) Sometime interviewer gives you the explanation but other times you need to remember it.

I hope these 20 questions should be enough to get you going on your preparation for Algorithms for Coding interviews. If you need more such coding questions you can take help from books like Cracking The Code Interview , by Gayle Laakmann McDowell which contains 189+ Programming questions and solution. A good book to prepare for programming job interviews in a short time.

basic algorithm problem solving in hindi

By the way, the more questions you solve in practice, the better your preparation will be. So, if you think this list of questions is not enough and you need more, then check out these additional 50 programming questions for telephone interviews and these books and courses for more thorough preparation.

Now You're Ready for the Coding Interview

These are some of the most common questions outside of data structure and algorithms that help you to do really well in your interview.

I have also shared a lot of these questions on my blog , so if you are really interested, you can always go there and search for them.

These common coding, data structure, and algorithms questions are the ones you need to know to successfully interview with any company, big or small, for any level of programming job.

If you are looking for a programming or software development job, you can start your preparation with this list of coding questions .

This list provides good topics to prepare and also helps assess your preparation to find out your areas of strength and weakness.

Good knowledge of data structure and algorithms is important for success in coding interviews and that's where you should focus most of your attention.

Resources to Prepare for Interviews

  • Cracking The Code Interview , by [Gayle Laakmann McDowell]
  • Data Structures and Algorithms: Deep Dive Using Java
  • From 0 to 1: Data Structures and Algorithms in Java
  • Data Structure and Algorithms Analysis --- Job Interview

Closing Notes

Thanks, You made it to the end of the article ... Good luck with your programming interview! It's certainly not going to be easy, but by following this searching and sorting algorithm questions, you are one step closer than others.

If you like this article, then please share with your friends and colleagues, and don't forget to follow javarevisited on Twitter as well!

Other Programming articles you may like:

  • 10 Books to Prepare Technical Programming/Coding Job Interviews
  • 10 Algorithm Books Every Programmer Should Read
  • Top 5 Data Structure and Algorithm Books for Java Developers
  • My favorite free courses to learn Algorithms in depth
  • 10 Free Data Structure Courses for Java Developers
  • A list of courses to Crack Programming Job Interviews
  • 10 Data Structure, Algorithms, and SQL Courses to Crack Coding Interview
P.S. --- If you need some FREE resources, you can check out this list of free data structure and algorithm courses to start your preparation.

Top comments (2)

pic

Templates let you quickly answer FAQs or store snippets for re-use.

clavinjune profile image

  • Location Jakarta, Indonesia
  • Joined Oct 5, 2018

You can do swap better with XOR operator tho.

  • Joined Sep 16, 2018

Yes, indeed, that's a nice trick for swapping. It's always better to bring such kind of alternative solution on real interviews, thanks for suggesting that.

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink .

Hide child comments as well

For further actions, you may consider blocking this person and/or reporting abuse

srishtikprasad profile image

The Module System in Javascript

Srishti Prasad - May 26

olatunjiayodel9 profile image

How to create an Artificial Intelligence - powered antivirus for mobile applications

Olatunji Ayodele Abidemi - May 15

dm8ry profile image

Python code that inserts a large number of records into a MySQL table.

Dmitry Romanoff - May 14

autotelico profile image

How to add a video into your website in Next.js 14

Henrique Magalhães - May 14

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

  • Data Science
  • Data Analysis
  • Data Visualization
  • Machine Learning
  • Deep Learning
  • Computer Vision
  • Artificial Intelligence
  • AI ML DS Interview Series
  • AI ML DS Projects series
  • Data Engineering
  • Web Scrapping

Problem Solving in Artificial Intelligence

  • Game Playing in Artificial Intelligence
  • Types of Reasoning in Artificial Intelligence
  • Artificial Intelligence - Terminology
  • Artificial Intelligence(AI) Replacing Human Jobs
  • Constraint Satisfaction Problems (CSP) in Artificial Intelligence
  • What Are The Ethical Problems in Artificial Intelligence?
  • Artificial Intelligence | An Introduction
  • Artificial Intelligence - Boon or Bane
  • What is Artificial Intelligence?
  • Artificial Intelligence in Financial Market
  • Artificial Intelligence Tutorial | AI Tutorial
  • Top 15 Artificial Intelligence(AI) Tools List
  • What is Artificial Narrow Intelligence (ANI)?
  • Artificial Intelligence Permeation and Application
  • Dangers of Artificial Intelligence
  • What is the Role of Planning in Artificial Intelligence?
  • Artificial Intelligence (AI) Researcher Jobs in China
  • Artificial Intelligence vs Cognitive Computing
  • 5 Mistakes to Avoid While Learning Artificial Intelligence

The reflex agent of AI directly maps states into action. Whenever these agents fail to operate in an environment where the state of mapping is too large and not easily performed by the agent, then the stated problem dissolves and sent to a problem-solving domain which breaks the large stored problem into the smaller storage area and resolves one by one. The final integrated action will be the desired outcomes.

On the basis of the problem and their working domain, different types of problem-solving agent defined and use at an atomic level without any internal state visible with a problem-solving algorithm. The problem-solving agent performs precisely by defining problems and several solutions. So we can say that problem solving is a part of artificial intelligence that encompasses a number of techniques such as a tree, B-tree, heuristic algorithms to solve a problem.  

We can also say that a problem-solving agent is a result-driven agent and always focuses on satisfying the goals.

There are basically three types of problem in artificial intelligence:

1. Ignorable: In which solution steps can be ignored.

2. Recoverable: In which solution steps can be undone.

3. Irrecoverable: Solution steps cannot be undo.

Steps problem-solving in AI: The problem of AI is directly associated with the nature of humans and their activities. So we need a number of finite steps to solve a problem which makes human easy works.

These are the following steps which require to solve a problem :

  • Problem definition: Detailed specification of inputs and acceptable system solutions.
  • Problem analysis: Analyse the problem thoroughly.
  • Knowledge Representation: collect detailed information about the problem and define all possible techniques.
  • Problem-solving: Selection of best techniques.

Components to formulate the associated problem: 

  • Initial State: This state requires an initial state for the problem which starts the AI agent towards a specified goal. In this state new methods also initialize problem domain solving by a specific class.
  • Action: This stage of problem formulation works with function with a specific class taken from the initial state and all possible actions done in this stage.
  • Transition: This stage of problem formulation integrates the actual action done by the previous action stage and collects the final stage to forward it to their next stage.
  • Goal test: This stage determines that the specified goal achieved by the integrated transition model or not, whenever the goal achieves stop the action and forward into the next stage to determines the cost to achieve the goal.  
  • Path costing: This component of problem-solving numerical assigned what will be the cost to achieve the goal. It requires all hardware software and human working cost.

author

Please Login to comment...

Similar reads, improve your coding skills with practice.

 alt=

What kind of Experience do you want to share?

IMAGES

  1. Algorithm and Flowchart

    basic algorithm problem solving in hindi

  2. Complete Chapter- Introduction to Problem Solving (In Hindi)

    basic algorithm problem solving in hindi

  3. DAA 1 7 Fundamentals of Algorithmic problem solving

    basic algorithm problem solving in hindi

  4. How to solve problems in life

    basic algorithm problem solving in hindi

  5. 8D Format in Hindi I 8 Disciplines of problem solving

    basic algorithm problem solving in hindi

  6. Algorithm क्या है, कैसे काम करता है?

    basic algorithm problem solving in hindi

VIDEO

  1. What is an Algorithm With Explanation in hindi|Algorithms in hindi|M3-R5 O level|Python Tutorials-1

  2. Basic Algorithm (Problem solving)

  3. #shorts [Hindi]

  4. For which problem algorithm be written? एल्गोरिथम कैसे प्रॉब्लम्स के लिए लिख सकते हैं?

  5. Python Tutorials for Beginners|Introduction to Programming|Problem Definition|o level M3-R5 in Hindi

  6. Understanding Algorithms in Problem-Solving #algorithm #problemsolving #code #understanding

COMMENTS

  1. Algorithm क्या है?

    Advantages of Algorithm in Hindi - एल्गोरिथम के फायदे. 1- Algorithm को समझना आसान होता है।. 2- यह किसी समस्या को सुलझाने में मदद करता है।. 3- एल्गोरिथ्म को वास्तविक ...

  2. Algorithm क्या है? परिभाषा और उदाहरण ( हिन्दी नोट्स)

    Algorithm एक प्रक्रिया हैं जिसमे किसी भी काम को आसान बनाने के लिए उसे कई चरणों में विभाजित कर पूर्ण किया जाता हैं. जैसे किसी एक प्रोग्राम को ...

  3. Algorithm क्या है?

    Algorithm की परिभाषा. Algorithm, निर्देशों (Instructions) का एक सेट है, जो किसी समस्या (Problem) को हल करने की पूरी प्रकिया (Procedure) को परिभाषित करता है। इसका प्रमुख ...

  4. Algorithms tutorials in Hindi(Beginner for Coding)

    The concept of an algorithm is one of the basic concepts in mathematics. Algorithm is a step-by-step problem solving procedure that can be Carried out by a computer. Finiteness: An algorithm should terminate after a finite number of steps, that is, when it is mechanically executed, it should come to a stop after executing a finite number of.

  5. Introduction to Algorithms in Hindi

    Learn about algorithm introduction in hindi with examples.Algorithm is a step by step procedure to solve a computational problem.Website: https://thecrazypro...

  6. Algorithm and Flowchart

    This video is Part - 1 of Algorithms, Flowcharts, Introduction to Problem Solving Algorithm and Flowchart for Beginners , Introduction to Problem Solving, Al...

  7. Algorithm

    To get Notes , Questions and Answers : you need to pay only Rs 69/- through paytm or bank transfer.Following are the bank details :Bank Details are :Account ...

  8. (Updated) Algorithm क्या है?

    9 Conclusion. एल्गोरिथ्म क्या है? (What is Algorithm in Hindi) Definition -: "किसी स्पेसिफिक प्रॉब्लम को सॉल्व करने के लिए लिखा जाने वाला step by step प्रोसीजर Algorithm कहलाता है ...

  9. ऍल्गोरिथम क्या है और आसानी से कैसे लिखें

    ऍल्गोरिथम क्या है (Algorithm in Hindi) Algorithm (Al-go-rith-um) यह एक तरीक़ा है (Step by Step Process) या फिर यह एक Formula है। जो की एक Problem को Solve करता है। यह एक ऐसा Procedure है जिसमे सीमित ...

  10. Algorithm क्या है? प्रकार और विशेषताएं

    Algorithm में समस्याओं को निर्देशों के जरिए हल किया जाता है। जिसमें ऐसे बहुत सी जरूरी चीजें शामिल होती हैं। जिसे आसानी से एल्गोरिथम काम ...

  11. Algorithm Design Techniques in Hindi

    हेल्लो दोस्तों! आज हम इस post में Algorithm Design Techniques in Hindi (अल्गोरिथ्म डिजाईन तकनीकों) के बारें में पूरे विस्तार में पढेंगे, तो चलिए शुरू करते है.. Algorithm Design Technique in Hindi

  12. BFS in hindi breadth first search and BFS algorithm in hindi

    1:- BFS (breadth first search) in hindi:-. BFS ग्राफ डेटा स्ट्रक्चर को travers तथा search करने की एक अल्गोरिथम है. इसका प्रयोग ग्राफ में shortest path को ढूँढने तथा puzzle गेम्स को solve ...

  13. Algorithm क्या है? Meaning of Algorithm in Hindi

    एल्गोरिथम कैसे बनाया जाता है इसे समझने के लिए हम algorithm के कुछ basic example को देखते हैं: Example 1: Write an algorithm to add two numbers entered by the user. (यूजर द्वारा इंटर किये गये ...

  14. Analysis of algorithm in Hindi

    Analysis of algorithm:-. कोई भी program data structure तथा algorithm दोनों का combination होता है. algorithm किसी भी specific problem को solve करने के लिए विभिन्न steps का combination होता है. algorithm को किसी भी problem ...

  15. Learn Data structure and algorithm in Python (Hindi)

    What you'll learn. Learn essential data structures & algorithms in Python, including arrays, linked lists, sorting, recursion, with practical LeetCode exercises. Ace coding interviews with proven tips & tricks. Optimize code, approach complex problems effectively & gain confidence in technical interviews. Hands-on coding examples & projects in ...

  16. How to Use Algorithms to Solve Problems?

    There must be "Start" as the first step and "End" as the last step of the algorithm. Let's take an example to make a cup of tea, Step 1: Start. Step 2: Take some water in a bowl. Step 3: Put the water on a gas burner. Step 4: Turn on the gas burner. Step 5: Wait for some time until the water is boiled.

  17. #algorithm

    #olevel #nielit #ratnakar #WhatisAlgorithm #Algorithms join the channel Telegram groupUNIQUE ONLINE GURU : - https://t.me/uniquegroups BCA with Ratnakar Sir ...

  18. Fundamentals of Algorithmic Problem Solving

    An input to an algorithm specifies an instance of the problem the algorithm solves. It is very important to specify exactly the set of instances the algorithm needs to handle. (As an example, recall the variations in the set of instances for the three greatest common divisor algorithms discussed in the previous section.)

  19. Algorithm Practice Question for Beginners

    In the field of graph theory, various shortest path algorithms especially Dijkstra's algorithm and Bellmann-Ford's algorithm repeatedly employ the use of the technique called Edge Relaxation. The idea of relaxation is the same in both algorithms and it is by understanding, the 'Relaxation property' we can fully grasp the working of the two ...

  20. Algorithm and Flowchart hindi

    Charges of Notes for Algorithm and flowchart is Rs 138/-One can pay thru paytm or google pay or phone number or upiPaytm Number is 9899056388Phone Pay Numbe...

  21. 20+ basic Algorithms Problems from Coding Interviews

    16. Write Algorithms to Check if Two String are Anagram (Solution) An anagram is something where length and character matches but not the order like Army and Mary, both have the same number of characters. One trick is to solve this problem is to sort the character array and check if they are the same or not. 17.

  22. What is Algorithm With Full Information?

    #Algorithm #QuickSupportWhat is Algorithm With Full Information? - [Hindi] - Quick Support. आज इस विडियो में हम आपको बताने वाले हैं ...

  23. Problem Solving in Artificial Intelligence

    The problem-solving agent performs precisely by defining problems and several solutions. So we can say that problem solving is a part of artificial intelligence that encompasses a number of techniques such as a tree, B-tree, heuristic algorithms to solve a problem. We can also say that a problem-solving agent is a result-driven agent and always ...