Chapter 1: Getting started with algorithms
Section 1.1: A sample algorithmic 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. The algorithmic problem known as sorting is defined as follows: [Skiena:2008:ADM:1410219]
Problem: Sorting
Input: A sequence of n keys, a_1, a_2, ..., a_n.
Output: The 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 strings, such as { Haskell, Emacs } or a sequence of numbers such as
{ 154, 245, 1337 }.
Comments
Post a Comment