Welcome To baselogics.blogspot.in

Jasper Roberts - Blog

Thursday, September 4, 2014

What is an algorithm?

                An algorithm is a procedure followed to accomplish a specific task. An algorithm is the idea behind any reasonable computer program. To be interesting, an algorithm must solve a general, well-specified problem. An algorithmic problem is specified by describing the complete set of instances it must work on and of its output after running on one of these instances. This distinction, between a problem and an instance of a problem, is fundamental. For example, the algorithmic problem known as sorting is defined as follows:
Problem: Sorting
Input: A sequence of n keys a1,...,an.
Output: The permutation (reordering) of the input sequence such that a 1 ≤ a 2 ≤ ···≤a n−1 ≤ a n.
                 An instance of sorting might be an array of names, like {Mike, Bob, Sally, Jill,Jan }, or a list of numbers like {154, 245, 568, 324, 654, 324}. Determining that you are dealing with a general problem is your first step towards solving it. An algorithm is a procedure that takes any of the possible input instances and transforms it to the desired output. There are many different algorithms for solving the problem of sorting. For example, insertion sort is a method for sorting that starts with a single element (thus forming a trivially sorted list) and then incrementally inserts the remaining elements so that the list stays sorted.

source:algorithm design manual

0 comments:

Post a Comment

Your Suggestions and Reviews are valuable to us to make this blog better........