Design & Analysis of Algoritms

Slides:



Advertisements
Similar presentations
Md. Ahsan Arif, Assistant Professor, Dept. of CSE, AUB
Advertisements

Analysis of Computer Algorithms
MATH 224 – Discrete Mathematics
CHAPTER 2 ALGORITHM ANALYSIS 【 Definition 】 An algorithm is a finite set of instructions that, if followed, accomplishes a particular task. In addition,
Programming Types of Testing.
Learning Objectives Explain similarities and differences among algorithms, programs, and heuristic solutions List the five essential properties of an algorithm.
Introductory Lecture. What is Discrete Mathematics? Discrete mathematics is the part of mathematics devoted to the study of discrete (as opposed to continuous)
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming The software development method algorithms.
What is an Algorithm? (And how do we analyze one?)
Algorithms and Problem Solving-1 Algorithms and Problem Solving.
CSE115/ENGR160 Discrete Mathematics 03/03/11 Ming-Hsuan Yang UC Merced 1.
Algorithms and Problem Solving. Learn about problem solving skills Explore the algorithmic approach for problem solving Learn about algorithm development.
CSE 830: Design and Theory of Algorithms
Copyright © Cengage Learning. All rights reserved. CHAPTER 11 ANALYSIS OF ALGORITHM EFFICIENCY ANALYSIS OF ALGORITHM EFFICIENCY.
Chapter 1 Program Design
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Design and Analysis of Algorithms - Chapter 11 Algorithm An algorithm is a.
Design and Analysis of Algorithms
Design & Analysis of Algorithms Introduction. Introduction Algorithms are the ideas behind computer programs. An algorithm is the thing which stays the.
Algorithm Design and Analysis Liao Minghong School of Computer Science and Technology of HIT July, 2003.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Operations Research Models
HOW TO SOLVE IT? Algorithms. An Algorithm An algorithm is any well-defined (computational) procedure that takes some value, or set of values, as input.
Computability and Modeling Computation What are some really impressive things that computers can do? –Land the space shuttle (and other aircraft) from.
Rev.S08 MAC 1140 Module 12 Introduction to Sequences, Counting, The Binomial Theorem, and Mathematical Induction.
Simple Program Design Third Edition A Step-by-Step Approach
CSC 201 Analysis and Design of Algorithms Lecture 03: Introduction to a CSC 201 Analysis and Design of Algorithms Lecture 03: Introduction to a lgorithms.
CS 103 Discrete Structures Lecture 01 Introduction to the Course
C. – C. Yao Data Structure. C. – C. Yao Chap 1 Basic Concepts.
1 Growth of Functions CS 202 Epp, section ??? Aaron Bloomfield.
MATH 224 – Discrete Mathematics
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 4 (Part 3): Mathematical Reasoning, Induction.
Introduction Algorithms and Conventions The design and analysis of algorithms is the core subject matter of Computer Science. Given a problem, we want.
Introduction to Algorithms Lecture 1. Introduction The methods of algorithm design form one of the core practical technologies of computer science. The.
10/14/ Algorithms1 Algorithms - Ch2 - Sorting.
Analyzing algorithms & Asymptotic Notation BIO/CS 471 – Algorithms for Bioinformatics.
Discrete Structures for Computing
Complexity of Algorithms
Major objective of this course is: Design and analysis of modern algorithms Different variants Accuracy Efficiency Comparing efficiencies Motivation thinking.
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
Design & Analysis of Algorithms Lecture 1 Introduction.
Program Efficiency & Complexity Analysis. Algorithm Review An algorithm is a definite procedure for solving a problem in finite number of steps Algorithm.
Introduction to Problem Solving. Steps in Programming A Very Simplified Picture –Problem Definition & Analysis – High Level Strategy for a solution –Arriving.
Algorithms & Flowchart
Algorithms & FlowchartsLecture 10. Algorithm’s CONCEPT.
Data Structures and Algorithm Analysis Introduction Lecturer: Ligang Dong, egan Tel: , Office: SIEE Building.
Data Structures and Algorithms Dr. Tehseen Zia Assistant Professor Dept. Computer Science and IT University of Sargodha Lecture 1.
UNIT-I INTRODUCTION ANALYSIS AND DESIGN OF ALGORITHMS CHAPTER 1:
CS404 Design and Analysis of Algorithms BBy DDr. M V S Peri Sastry BB.E, PhD(BITS-Pilani)
Chapter 10 Algorithmic Thinking. Learning Objectives Explain similarities and differences among algorithms, programs, and heuristic solutions List the.
DATA STRUCTURES (CS212D) Overview & Review Instructor Information 2  Instructor Information:  Dr. Radwa El Shawi  Room: 
Program Correctness. The designer of a distributed system has the responsibility of certifying the correctness of the system before users start using.
1 2/21/2016 MATH 224 – Discrete Mathematics Sequences and Sums A sequence of the form ar 0, ar 1, ar 2, ar 3, ar 4, …, ar n, is called a geometric sequence.
BITS Pilani Pilani Campus Data Structure and Algorithms Design Dr. Maheswari Karthikeyan Lecture1.
CSC-305 Design and Analysis of AlgorithmsBS(CS) -6 Fall-2014CSC-305 Design and Analysis of AlgorithmsBS(CS) -6 Fall-2014 Design and Analysis of Algorithms.
1.  A step by step process to solve any problem is called algorithm.  Algorithm is a process which take some values as input and provide us output.
Introductory Lecture. What is Discrete Mathematics? Discrete mathematics is the part of mathematics devoted to the study of discrete (as opposed to continuous)
Computer Systems Architecture Edited by Original lecture by Ian Sunley Areas: Computer users Basic topics What is a computer?
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
Advanced Algorithms Analysis and Design
Algorithms and Problem Solving
Algorithm Analysis CSE 2011 Winter September 2018.
Unit# 9: Computer Program Development
Algorithms Chapter 3 With Question/Answer Animations
Algorithm An algorithm is a finite set of steps required to solve a problem. An algorithm must have following properties: Input: An algorithm must have.
Objective of This Course
Asst. Dr.Surasak Mungsing
Algorithms and Problem Solving
Basic Concepts of Algorithm
Design and Analysis of Algorithms
Discrete Mathematics and Its Applications
Presentation transcript:

Design & Analysis of Algoritms Ernastuti

Algorithm The word algorithm comes from the name of a Persian author, Abu Ja’far Mohammed ibn Musa al Khowarizmi (825 A.D) who wrote a textbook on mathematics.

Algorithm Algorithm is any special method of solving a certain kind of problem. But this word has taken on a special significance in computer science, where algorithm has come to refer to a precise method useable by a computer for the solution of a problem.

This is what makes the notion of an algorithm different from words such as process, technique or method.

An Algorithm is composed of finite set of steps, each of which may require one or more operations. Each operation must definite, meaning that it must be perfectly clear what should be done. Directions such as “compute 5/0” or “add 6 or 7 to x” are not permitted because it is not clear what the result is or which of the two possibilities should be done.

Another important property each operation should have is that it be effective; each step must be such that it can, at least in principle, be done by a person using pencil and paper in a finite amount of time. Performing arithmetic on integers is an example of an effective operation, but arithmetic with real numbers is not, since some values may be expressible only by an infinitely long decimal expansion. Adding two such numbers would violate the effectiveness property.

An algorithm produces one or more outputs and may have zero or more inputs which are externally supplied.

Another important criterion which will be assumed about algorithms is that they terminate after a finite number of operations.

There is another word for an algorithm which obeys all of the above properties (finite set of steps, definite, effective) except termination, and that is computational procedure. One important example of a computational procedure is the operating system of a digital computer. This procedure is designed to control the execution of jobs, such that when no jobs are available, it does not terminate, but continues in a waiting state until a new job is entered. Though computational procedures include important examples such as this one, we will restrict our study to these computional procedures which always terminate.

Algorithm 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 squence of computational steps that transform the input into the output.

Program A Program is the expression of an algorithm in a programming language.

In order to help us achieve the criterion of definiteness, algorithm will be written in a programming language. Most of you have already programmed and run some algorithms on a computer. This is desirable because before one studies a concept in general it helps if one has had some practical experience with it.

Perhaps you had some difficulty getting started in formulating an initial solution to a problem, or perhaps you were unable to decide which of two algorithms was better. The goal of this course is to teach you how to make these decisions.

The study of algorithms includes many important and active areas of research. There are perhaps five distinct areas of study one can identify : 1. How to devise algorithms 2. How to analyze algorithms 3. How to express algorithms 4. How to validate algorithms 5. How to test algorithms

1. How to devise algorithms The act of creating an algorithm is an art which may never be fully automated. A major goal of this course is to study various design techniques which have proven to be useful in that they have often yielded good algorithms.

Design of algorithm A knowledge of design will certainly help one to create a good algorithms, yet without the tools of analysis there is no way to determine the quality of the result. There are several design strategies/ techniques , such as : devide-and-conquer, the greedy method, dynamic programming, search- and-traversal, backtracking & branch-and-bound.

2. How to analyze algorithms This field of study is called analysis algorithms. As an algorithm is executed, it makes use of the computer’s central processing unit (CPU) to perform operations and it uses the memory to hold the program and its data. Analysis of algorithms refers to the process of determining how much computing time and storage an algorithm will require. This is a challenging one which sometimes requires great mathematical skill.

Analysis of algorithm Analyzing even a simple algorithm can be a challenge. The mathematical tools required may include discrete combinatorics, elementary probability theory, algebraic dexterity, and the ability to identify the most significant terms in a formula.

3. How to express algorithms A Program is the expression of an algorithm in a programming language.

4. How to validate algorithms Once an algorithm is devised it is necessary to show that it computes the correct answer for all possible legal inputs. We refer to this process as algorithm validation. The purpose of the validation is to assure us that this algorithm will work correctly independent of the issues concerning the programming language it will eventually be written in.

Once the validity of the method has been shown, a program can be written and a second phase begins. This phase is referred to as program verification. A proof of correctness requires that the solution be stated in two forms. One form is usually as a program which is annotated by a set of assertions about the input and output variables of the program. These assertions are often expressed in the predicate calculus. The second form is called a specification and this may also be expressed in the predicate calculus. A complete proof of program correctness requires that each statement of the programming language be pricisely defined and that all basic operations be proved correct. All these details may cause a proof to be very much longer than the program.

5. How to test a program Testing a program really consists of two phases Debugging and Profilling. Debugging is the process of executing programs on sample data sets to determine if faulty results occur and, if so, to correct them ! A proof of correctness is much more valuable than a thousand tests, ( if that proof is correct ), since it guarantees that the program will work correctly for all possible inputs.

Profilling is the process of executing a correct program on data sets and measuring the time and space it takes to compute the results. This timing figures are useful in that they may confirm a previously done analysis and point out logical places to perform useful optimization.

As we can’t hope to cover all of these five categories completely, we will content ourselves with concentrating on design and analysis, spending less time on program construction and correctness. One can see that the subject of algorithms is a very diverse and challenging one.

What are the prerequisites for understanding the D&AoA course You should have some programming experience. In particular, you should understand recursive procedures and simple data structures as arrays and linked lists. You should have some facility with proofs by mathematical induction.

Algorithm devised to solve the same problem often differ dramatically in their efficiency. These differences can be much more significant than the difference between a personal computer and supercomputer. As an example, let us pit a supercomputer running insertion sort againts a small personal computer running mergesort. They each must sort an array of one million numbers.

Suppose the supercomputer executes 100 million instructions per second, while the personal computer executes only one million instructions per second. To make the difference even more dramatic, suppose that the world’s craftiest programmer codes insertion sort in machine language for the supercomputer, and the resulting code requires 2n2 supercomputer instructions to sort n numbers. Mergesort, on the other hand, is programmed for personal computer by an average programming using a high level language with an inefficient compiler, with the resulting code taking 50n log n .

To sort a million numbers : The supercomputer takes 2.(106)2 instructions / 108 instructions/seconds = 20,000 seconds  5.56 hours While the personal computer takes 50.(106) log 106 instr / 106 instructions/seconds  1,000 seconds  16.67 minutes

By using an algorithm whose running time has a lower order of growth, even with a poor compiler, the personal computer runs 20 times faster than the supercomputer. This example shows that algorithms, like computer hardware, are a technology. Total system performance depends on choosing efficient algorithms as much as on choosing fast hardware. Just as rapid advances are being made in other computer technologies, they are being made in algorithms as well.