# Algorithm

An algorithm can be defined as a well-defined computational procedure that takes some values, or the set of values, as an input and produces some value, or the set of values, as an output. An algorithm is thus a sequence of computational steps that transform the input into output.

It describes specific computational procedures for achieving the input-output relationship.

For Example, We need to sort the sequence of number into ascending order. Here is how we define the sorting problem.

Input:

```A sequence of n number (a1, a2,......an)
```

Output:

```A permutation (reordering) (a'1, a'2 .... a'n) of the input sequence such that (a'1 ≤ a'2 ≤ ....≤ a'n)
```

### An algorithm must have the following properties:

• Correctness: It should produce the output according to the requirement of the algorithm
• Finiteness: Algorithm must complete after a finite number of instructions have been executed.
• An Absence of Ambiguity: Each step must be defined, having only one interpretation.
• Definition of Sequence: Each step must have a unique defined preceding and succeeding step. The first step and the last step must be noted.
• Input/output: Number and classification of needed inputs and results must be stated.
• Feasibility: It must be feasible to execute each instruction.
• Flexibility: It should also be possible to make changes in the algorithm without putting so much effort on it.
• Efficient - Efficiency is always measured in terms of time and space requires implementing the algorithm, so the algorithm uses a little running time and memory space as possible within the limits of acceptable development time.
• Independent: An algorithm should focus on what are inputs, outputs and how to derive output without knowing the language it is defined. Therefore, we can say that the algorithm is independent of language.

Next TopicNeed of Algorithm
{"ft_lang_label":"__label__en","ft_lang_prob":0.88786,"math_prob":0.9382787,"size":1826,"snap":"2019-51-2020-05","text_gpt3_token_len":376,"char_repetition_ratio":0.13062568,"word_repetition_ratio":0.020408163,"special_character_ratio":0.21139102,"punctuation_ratio":0.15339233,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9894973,"pos_list":[0,1,2,3,4,5,6],"im_url_duplicate_count":[null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-01-25T08:11:43Z\",\"WARC-Record-ID\":\"<urn:uuid:ea6b4ee0-a58d-4fba-ae05-693023028d1b>\",\"Content-Length\":\"57843\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:c42fb2d6-a9e4-4e0c-aac2-acf5d8546bf3>\",\"WARC-Concurrent-To\":\"<urn:uuid:9b3473fa-ba15-46ac-8e89-0a25cc55420b>\",\"WARC-IP-Address\":\"194.169.80.121\",\"WARC-Target-URI\":\"https://www.javatpoint.com/daa-algorithm\",\"WARC-Payload-Digest\":\"sha1:SZAUIZXYKYKYSWWFR7HCGNIO5HVSXBTR\",\"WARC-Block-Digest\":\"sha1:BHRVH2O7OSVD2VSEPM4ARGO5O45MEDCT\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-05/CC-MAIN-2020-05_segments_1579251671078.88_warc_CC-MAIN-20200125071430-20200125100430-00479.warc.gz\"}"}