Professional Documents
Culture Documents
Chapter 1
Chapter 1
Algorithms
An algorithm is a well-defined computational procedure that takes some value, or set of values as
input and produces some value or set of values as output.
or
Instance of a problem consists of the input required to compute the solution to the problem. It
satisfies that constraints imposed on it by the problem statement.
An algorithm is correct if for every problem instance it halts with the correct output.
Internet
Electronic commerce
Depends on privacy of personal info, using cryptography and numerical signatures which uses algo
and no. theory.
Assigning crews in airplanes or where to place oil wells in mining industry etc.
Data structures - A data structure is a way to store data in order to facilitate access and modification
Hard problems
Algorithms as a technology
Computing time is a bounded resource and memory is not free. Resource need to be used wisely.
Efficiency
Different algorithms that solve the same problem may differ dramatically in their efficiency.
Example:
2
Insertion sort takes roughly c 1 n time to sort n items
Typically, c 1 <c 2
Even though insertion sort is faster in smaller input sizes, merge is faster in larger sets because its
advantage of lg n vs . n more than compensates for difference in cost factors.