28_split_Introduction to Algorithms 2nd Edition

28_split_Introduction to Algorithms 2nd Edition -...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
1 The Role of Algorithms in Computing What are algorithms? Why is the study of algorithms worthwhile? What is the role of algorithms relative to other technologies used in computers? In this chapter, we will answer these questions. 1.1 Algorithms Informally, an algorithm is any well-defined computational procedure that takes some value, or set of values, as input and produces some value, or set of values, as output . An algorithm is thus a sequence of computational steps that transform the input into the output. We can also view an algorithm as a tool for solving a well-specified computa- tional problem . The statement of the problem specifies in general terms the desired input/output relationship. The algorithm describes a specific computational proce- dure for achieving that input/output relationship. For example, one might need to sort a sequence of numbers into nondecreasing order. This problem arises frequently in practice and provides fertile ground for
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: introducing many standard design techniques and analysis tools. Here is how we formally dene the sorting problem : Input: A sequence of n numbers a 1 , a 2 ,... , a n . Output: A permutation (reordering) a 1 , a 2 , ... , a n of the input sequence such that a 1 a 2 a n . For example, given the input sequence 31 , 41 , 59 , 26 , 41 , 58 , a sorting algorithm returns as output the sequence 26 , 31 , 41 , 41 , 58 , 59 . Such an input sequence is called an instance of the sorting problem. In general, an instance of a problem consists of the input (satisfying whatever constraints are imposed in the problem statement) needed to compute a solution to the problem. Sorting is a fundamental operation in computer science (many programs use it as an intermediate step), and as a result a large number of good sorting algorithms...
View Full Document

This document was uploaded on 11/22/2010.

Ask a homework question - tutors are online