Procedure and Recursion

Under this mechanism, the sequence of instructions expected to be repeatedly used in one or more algorithms, is written only once and outside and independent of the algorithms of which the sequence could have been a part otherwise. There may be many such sequences and hence, there is need for an identification of each of such sequences. For this purpose, each sequence is prefaced by statements in the following format:

where <NAME>(<PARAMETER-LIST> and  , and other expressions with in the angular brackets as first and last symbols, are place-holders for suitable values that are to be substituted in their places. For example, suppose finding the sum of squares of two variables is a frequently required activity, then we may write the code for this activity independent of the algorithm of which it would otherwise have formed a part. And then, in (1.6.3.1), may be replaced by ‘sum-square’ and by the twoelement sequence x, y. The variables like x when used in the definition of an algorithm, are called formal parameters or simply parameters. Further, whenever the code which now forms a part of a procedure, say sum-square is required at any place in an algorithm, then in place of the intended code, a statement of the form

इस तंत्र के तहत, एक या एक से अधिक एल्गोरिदम में बार-बार उपयोग किए जाने वाले अपेक्षित निर्देशों का अनुक्रम, केवल एक बार और बाहर लिखा जाता है और एल्गोरिदम से स्वतंत्र होता है जिसके क्रम अनुक्रम अन्यथा हो सकता था। ऐसे कई दृश्य हो सकते हैं और इसलिए, इस तरह के प्रत्येक अनुक्रम की पहचान की आवश्यकता है। इस प्रयोजन के लिए, प्रत्येक अनुक्रम निम्नलिखित प्रारूपों में बयानों द्वारा प्रस्तुत किया गया है:

जहां <NAME> (<PARAMETER-LIST> और, और अन्य अभिव्यक्ति जो पहले और अंतिम प्रतीकों के रूप में कोणीय कोष्ठक में हैं, उपयुक्त जगहों के स्थान-धारक हैं जिन्हें उनके स्थान पर प्रतिस्थापित किया जाना है। उदाहरण के लिए, दो चर के वर्ग अक्सर आवश्यक गतिविधि होती है, तो हम एल्गोरिथम से स्वतंत्र इस एक्टिविटी के लिए कोड लिख सकते हैं, जिसकी वजह से अन्यथा कोई हिस्सा बन जाएगा। और फिर, (1.6.3.1) में, स्क्वायर ‘और दो एलेमेंट अनुक्रम x, वाई द्वारा वे चर जैसे एल्गोरिथम की परिभाषा में इस्तेमाल किए जाने वाले को औपचारिक मापदंडों या केवल पैरामीटर कहा जाता है। इसके अलावा, जब भी कोड जो किसी प्रक्रिया का एक हिस्सा होता है, तो सम-वर्ग एल्गोरिथम में किसी भी स्थान पर आवश्यक है, फिर इच्छित कोड के स्थान पर, फॉर्म का एक बयान

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

error: Content is protected !!