What is an algorithm? Informally: An Algorithm is a step by step method for solving a problem. It’s purpose is to break a larger task down so that each.

Slides:



Advertisements
Similar presentations
CHAPTER 2 ALGORITHM ANALYSIS 【 Definition 】 An algorithm is a finite set of instructions that, if followed, accomplishes a particular task. In addition,
Advertisements

CPSC 171 Introduction to Computer Science Efficiency of Algorithms.
1 Chapter Six Algorithms. 2 Algorithms An algorithm is an abstract strategy for solving a problem and is often expressed in English A function is the.
Understanding the Three Basic Structures
8 Algorithms Foundations of Computer Science ã Cengage Learning.
ITEC113 Algorithms and Programming Techniques
CMPUT101 Introduction to Computing(c) Yngvi Bjornsson & Jia You1 Algorithm Discovery and Design Chapter 2 Topics: Representing Algorithms Algorithmic Problem.
Computer Software & Software Development H&K Chapter 1 Instructor – Gokcen Cilingir Cpt S 121 (June 20, 2011) Washington State University.
Lecture 14 Go over midterm results Algorithms Efficiency More on prime numbers.
Program Design and Development
Chapter 2 The Algorithmic Foundations of Computer Science
Unit 171 Algorithms and Problem Solving  Introduction  Algorithm Design  Algorithm Properties  Algorithm Control Flow  Examples  Comparing Algorithms.
Algorithm Design CS105. Problem Solving Algorithm: set of unambiguous instructions to solve a problem – Breaking down a problem into a set of sub- problems.
Gender of Computers? An English teacher was explaining to his students the concept of gender association in the English language. He stated how hurricanes.
Chapter 2: Algorithm Discovery and Design
ALGORITHMS AND FLOW CHARTS 1 Adapted from the slides Prepared by Department of Preparatory year Prepared by: lec. Ghader Kurdi.
Factors Terminology: 3  4 =12
Adapted from slides by Marie desJardins
Introduction Dr. Ying Lu RAIK 283: Data Structures & Algorithms.
CSCI-100 Introduction to Computing Algorithms Part I.
An ordered sequence of unambiguous and well-defined instructions that performs some task and halts in finite time Let's examine the four parts of this.
CPSC 171 Introduction to Computer Science 3 Levels of Understanding Algorithms More Algorithm Discovery and Design.
Introduction to Programming. What is a Program  Set of Instructions that tells the computer what to Do.  Driving force behind the computer  Without.
Algorithmic Problem Solving CMSC 201 Adapted from slides by Marie desJardins (Spring 2015 Prof Chang version)
计算机科学概述 Introduction to Computer Science 陆嘉恒 中国人民大学 信息学院
1 Chapter 1 Analysis Basics. 2 Chapter Outline What is analysis? What to count and consider Mathematical background Rates of growth Tournament method.
计算机科学概述 Introduction to Computer Science 陆嘉恒 中国人民大学 信息学院
Lesson 3- using rules of exponents The exponent, tells the number of times that the base is used as a factor 2 3 is defined as 2 times 2 times 2.
Bill Payment Optimization Algorithms. Purpose To find and/or construct algorithms that will optimize the decision process of paying bills from an account.
Writing Program Code in BASIC Write a program to prompt for and accept values into TWO variables, numx and numy. The program should square the value stored.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
CPSC 171 Introduction to Computer Science Algorithm Discovery and Design.
CPSC 171 Introduction to Computer Science More Algorithm Discovery and Design.
ITEC113 Algorithms and Programming Techniques
Java Programming: Guided Learning with Early Objects Chapter 11 Recursion.
Basic Control Structures
1 Section 2.1 Algorithms. 2 Algorithm A finite set of precise instructions for performing a computation or for solving a problem.
1 Program Planning and Design Important stages before actual program is written.
CSCI-100 Introduction to Computing
17 November 2015Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems.
© Janice Regan, CMPT 128, February CMPT 128: Introduction to Computing Science for Engineering Students Recursion.
The Hashemite University Computer Engineering Department
8.1 8 Algorithms Foundations of Computer Science  Cengage Learning.
Factor A factor of an integer is any integer that divides the given integer with no remainder.
Invitation to Computer Science 5 th Edition Chapter 2 The Algorithmic Foundations of Computer Science.
INVITATION TO Computer Science 1 11 Chapter 2 The Algorithmic Foundations of Computer Science.
Problem-solving with Computers. 2Outline  Computer System  5 Steps for producing a computer program  Structured program and programming  3 types of.
ALGORITHMS AND FLOWCHARTS. Why Algorithm is needed? 2 Computer Program ? Set of instructions to perform some specific task Is Program itself a Software.
Chapter 2: Algorithm Discovery and Design Invitation to Computer Science.
Long Division. Warm Up Exercise Solve for the following problems 1.56 ÷ ÷ ÷ ÷ ÷ 6.
Problem Solving & Computer Programming
Algorithms and Problem Solving
CSIS 104 –Intro. To Computer Science
ALGORITHMS AND FLOWCHARTS
Topic:- ALGORITHM Incharge Faculty – Lokesh Sir.
Courtsey & Copyright: DESIGN AND ANALYSIS OF ALGORITHMS Courtsey & Copyright:
Lecture 2: Introduction to Algorithms
COMS W1004 Introduction to Computer Science and Programming in Java
Lecture 2 Introduction to Computer Science (continued)
Understanding the Three Basic Structures
Computation in Other Bases
Algorithm Discovery and Design
Algorithm Discovery and Design
Introduction to Algorithms and Programming
Computer Programming.
Introduction to Computer Science
Click to add Text Computers & Instructions. Computers are given instructions in the form of computer programs that are created through the development.
What role does place value have in whole number operations?
Computer Science 101 Survey of Computer Science
Presentation transcript:

What is an algorithm? Informally: An Algorithm is a step by step method for solving a problem. It’s purpose is to break a larger task down so that each step can be carried out without creativity

What is an Algorithm? Formal definition: An algorithm is a well ordered collection of unambiguous and effectively computable operations that produces a result and halts in a finite amount of time.

An Algorithm is Well Ordered Each step of the algorithm is executed in the order in which it is written, or else the order is clearly stated. What is wrong with this algorithm to average two numbers? Step 1: Divide the sum by 2 Step 2: Add the two numbers

An Algorithm is Unambiguous The operation can be carried out without further explanation or simplification.

An Algorithm is Effectively Computable It must be possible for the computing agent to perform the operation and produce a result. The operation must be doable. Can’t ask to print out list of all prime numbers.

An Algorithm Must Halt in a Finite Amount of Time Even if it would take centuries to finish executing the algorithm, there is some point in time when the result would be produced. What is wrong with this algorithm? Step 1. Set X to –1 Step 2. Subtract 1 from X Step 3. If X is not 0, go back to Step 2.

More about Algorithms The order in which the steps of an algorithm are executed is one of the following: sequential conditional iterative

Sequential Order Each step is performed in the order in which it is written. Example: Algorithm for finding a sale price. Step 1. Multiply the regular price by the discount percent. Step 2. Subtract the result of Step 1 from the regular price.

Conditional Order Determines whether or not a condition is true; and, based on whether or not it is true, selects the next step to do. Example-- Algorithm for processing a bank check: Step 1. Determine if the amount of the check is greater than the checking account balance. Step 2. If Step 1 is true, print “Overdraft” Step 3. Otherwise, subtract the amount of the check from the balance.

Iterative Operation Repeat a set of steps over and over -- also called a “looping” operation. Example: Algorithm for counting the digits in a positive integer N. Step 1. Set the Count to 0 Step 2. Divide N by 10 (dropping any remainder) Step 3. Add 1 to the Count Step 4. If N is greater than 0, repeat steps 2-4

Attributes of Algorithms Correct Efficient –Time how long to solve problem –Space how much memory needed Easy to Understand –Program maintenance Elegant

Comparing Algorithms Possible to come up with several algorithms to solve same problem Which is “best” –Most time efficient –Most space efficient –Easiest to maintain

Measuring Efficiency 2 algorithms may be functionally correct 1 may be more efficient How is efficiency measured –Determine least computing time –Determine least amount of work (fundamental steps)