Important Notice:

Course Content
Introduction to Programming (Chapter 1) M3-R5.1
About Lesson

How to Write an Algorithm?

Algorithm लिखने से पहले कुछ बातों का ध्यान रखना पड़ता है।  इसे लिखने से पहले कई सारे चीजों को अच्छी तरह से analyze करते हैं। कई तरह के Parameter को ध्यान में रख कर Algorithm को लिखा जाता है। आइए समझते है कि वह कौन-कौन से कारक है, जिसे Algorithm लिखने से पहले समझना जरूरी है|

  1. The Problem(समस्या) – सर्वप्रथम हमें दिए गए problem को समझना पड़ता है। अगर हम problem को समझ गए। तो समझिए problem का आधा solution मिल गया। इसलिए problem क्या है, इसको अच्छी तरह से analyze करना बहुत जरूरी होता है।
  2. The Constraints( शर्तें)– problem को अच्छी तरह से समझ लेने के बाद उसके solution निकालने के क्रम में कौन-कौन सी शर्तों का पालन करना है। इन शर्तों को अच्छी तरह से समझना तथा उनका ध्यान रखना जरूरी होता है।
  3. The Input– problem का solution निकालने के लिए किस तरह की इनपुट की जरूरत होगी। इनपुट का प्रकार क्या होगा, उनकी संख्या क्या होगी। यह सुनिश्चित करना जरूरी हो जाता है।
  4. The Output(परिणाम) – इनपुट लेने के बाद Algorithm किस प्रकार का आउटपुट प्रदान करेगा। इसे भी पहले से समझ लेना पड़ता है। आउटपुट का प्रकार क्या होगा तथा इसे किस तरह से प्रदर्शित किया जाएगा।
  5. The Solution (समाधान)– problem, शर्तें, इनपुट, तथा आउटपुट को अच्छी तरह से analyze कर लेने के बाद उसके solution का analysis करते हैं। यह किस तरह से step by step लिखा जाएगा, किस तरह से हम इनपुट का उपयोग उपयोग करेंगे, इसके प्रोसेसिंग में कौन सा फार्मूला लगाएंगे इत्यादि बातों को analyze करते हैं।

Note:- An algorithm can even be written in Algol (ALGOrithmic Language) what is very clear and in steps to justify the program objective.

 

How to Write an Algorithm?

There are no well-defined standards for writing algorithms. Rather, it is problem and resource dependent. Algorithms are never written to support a particular programming code.

As we know that all programming languages share basic code constructs like loops (do, for, while), flow-control (if-else), etc. These common constructs can be used to write an algorithm.

We write algorithms in a step-by-step manner, but it is not always the case. Algorithm writing is a process and is executed after the problem domain is well-defined. That is, we should know the problem domain, for which we are designing a solution.

Note:- An algorithm can even be written in Algol (ALGOrithmic Language) what is very clear and in steps to justify the program objective.

error: Content is protected !!