80 likes | 213 Views
Introduction. What is an Algorithm?. An algorithm is: a sequence of elementary computational steps that transforms the input into the output . An algorithm is: a tool for solving a well-specified computational problem , eg. Sorting, Multiplication.
E N D
What is an Algorithm? An algorithm is: a sequence of elementary computational steps that transforms the inputinto the output. An algorithm is: a tool for solving a well-specified computational problem, eg. Sorting, Multiplication. A correct algorithm:for every input instance, it halts with the correct output.
A Sorting Problem ASorting Problem Input : <a1, a2, …, an> Output : A permutation (re-ordering) < a’1, a’2, …, a’n> of the input sequence such that a’1a’2 … a’n. Example: <31, 41, 59, 26, 41, 58> => < > An instance of the sorting problem.
Which algorithm is best, eg. for a sorting problem? The best algorithm Answer these questions first: • Number of items to be sorted? • Are the items already somewhat sorted? • Any restrictions on the item values? • What kind of storage device (main memory? Disks?)
Other examples of problems • Identifying 100,000 genes in human DNA. Determining the sequences of 3,000,000,000 base pairs. => Sorting and Order statistics • Internet search engine => Graph algorithms, hash tables, string matching • Find all x and n that satisfies 1079*x = 80642173 (mod n)Cryptography and digital signatures => Numerical problems
Other examples of problems • Winning an election => Linear Programming • Triangulation of polygon => Dynamic Programming • Identifying the convex hull => Computational Geometry
Tractable: The set of problems with efficient solutions known. NP-Complete Problems NP-Complete Problems All known problems: No efficient solution is known yet. • Nobody has ever proven that an efficient algorithm for one cannot exist. • If an efficient algorithm exists for any one of them, then efficient algorithms exist for all of them !!! • Several NP-Complete problems are similar to some tractable ones. Eg. Traveling-salesman problem However, “Approximation Algorithms” exist !!!
Core Topics • Analysis of Algorithms • Divide and Conquer • Dynamic Programming • Greedy Algorithms • Computational Geometry • Graph Algorithms • String Algorithms • NP-Completeness