Algorithms, Part 1 of 3 Topics Definition of an Algorithm

Slides:



Advertisements
Similar presentations
1 ICS102: Introduction To Computing King Fahd University of Petroleum & Minerals College of Computer Science & Engineering Information & Computer Science.
Advertisements

CSci 107 Introduction to Computer Science Lecture 1.
CMSC 104, Version 8/061L04Algorithms1.ppt Algorithms, Part 1 of 3 Topics Definition of an Algorithm Algorithm Examples Syntax versus Semantics Reading.
Computer Algorithms. Fact: computers are dumb machines Basic property of a computer (a machine): Computers do what we tell them to do Unfortunately, computer.
8 Algorithms Foundations of Computer Science ã Cengage Learning.
Computer Software & Software Development H&K Chapter 1 Instructor – Gokcen Cilingir Cpt S 121 (June 20, 2011) Washington State University.
Chapter 1: An Introduction to Computer Science Invitation to Computer Science, C++ Version, Third Edition.
Algorithms and Problem Solving-1 Algorithms and Problem Solving.
CSci 107 Introduction to Computer Science Lecture 1.
CSCI 3 Introduction to Computer Science. CSCI 3 Course Description: –An overview of the fundamentals of computer science. Topics covered include number.
Algorithms and Problem Solving. Learn about problem solving skills Explore the algorithmic approach for problem solving Learn about algorithm development.
Programming Fundamentals (750113) Ch1. Problem Solving
TK3043 Analysis and Design of Algorithms Introduction to Algorithms.
Design & Analysis of Algorithms Introduction. Introduction Algorithms are the ideas behind computer programs. An algorithm is the thing which stays the.
Introduction Dr. Ying Lu RAIK 283: Data Structures & Algorithms.
1 L07SoftwareDevelopmentMethod.pptCMSC 104, Version 8/06 Software Development Method Topics l Software Development Life Cycle Reading l Section 1.4 – 1.5.
Introduction Algorithms and Conventions The design and analysis of algorithms is the core subject matter of Computer Science. Given a problem, we want.
Review Introduction to Searching External and Internal Searching Types of Searching Linear or sequential search Binary Search Algorithms for Linear Search.
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.
CMSC 1041 Algorithms I An Introduction to Algorithms.
Algorithms, Part 1 of 3 Topics  Definition of an Algorithm  Algorithm Examples  Syntax versus Semantics Reading  Sections
Design & Analysis of Algorithms Lecture 1 Introduction.
CMSC 1041 Algorithms I An Introduction to Algorithms.
Algorithms & FlowchartsLecture 10. Algorithm’s CONCEPT.
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)
8.1 8 Algorithms Foundations of Computer Science  Cengage Learning.
CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Operating Systems and Using Linux Review Operating System. Linux Overview. Frequently Used Linux.
1 UMBC CMSC 104, Section Fall 2002 Algorithms, Part 1 of 3 Topics Definition of an Algorithm Algorithm Examples Syntax versus Semantics Reading.
| MSC 8102:PROGRAMMING CONCEPTS By Vincent Omwenga, PhD. 1.
Low-Level Programming Languages, Pseudocode and Testing Chapter 6.
CMSC 104, L041 Algorithms, Part 1 of 3 Topics Definition of an Algorithm Example: The Euclidean Algorithm Syntax versus Semantics Reading Sections 3.1.
Introduction to Algorithms
Problem Solving & Computer Programming
Algorithms and Problem Solving
Algorithms, Part 1 of 3 The First step in the programming process
TK3043 Analysis and Design of Algorithms
GC211Data Structure Lecture2 Sara Alhajjam.
Chapter 1 Introduction Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
What is an algorithm? An algorithm is a sequence of unambiguous instructions for solving a problem, i.e., for obtaining a required output for any legitimate.
Algorithm and Ambiguity
What is an algorithm? An algorithm is a sequence of unambiguous instructions for solving a problem, i.e., for obtaining a required output for any legitimate.
Algorithms I: An Introduction to Algorithms
Algorithm and Ambiguity
Computer Science 101 While Statement.
2008/09/24: Lecture 6b CMSC 104, Section 0101 John Y. Park
2008/09/17: Lecture 4 CMSC 104, Section 0101 John Y. Park
PROBLEM SOLVING SKILLS
CSci 107 Introduction to Computer Science
Programming Fundamentals (750113) Ch1. Problem Solving
Programming Fundamentals (750113) Ch1. Problem Solving
UMBC CMSC 104 – Section 01, Fall 2016
Algorithm Discovery and Design
KNOWLEDGE REPRESENTATION
Introduction to Algorithms and Programming
Problem Solving Skill Area 305.1
Algorithm and Ambiguity
Algorithms and Problem Solving
Algorithms, Part 1 of 3 Topics Definition of an Algorithm
Programming Fundamentals (750113) Ch1. Problem Solving
Introduction to Algorithms
CS 416 Artificial Intelligence
Lecture 6 Architecture Algorithm Defin ition. Algorithm 1stDefinition: Sequence of steps that can be taken to solve a problem 2ndDefinition: The step.
Computer Algorithms.
Programming Fundamentals (750113) Ch1. Problem Solving
Introduction to Algorithms
Algorithms, Part 1 of 3 Topics Definition of an Algorithm
Chapter 1 Introduction Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Presentation transcript:

Algorithms, Part 1 of 3 Topics Definition of an Algorithm Algorithm Examples Syntax versus Semantics Reading Sections 3.1 - 3.3

Problem Solving Problem solving is the process of transforming the description of a problem into the solution of that problem. We use our knowledge of the problem domain. We rely on our ability to select and use appropriate problem-solving strategies, techniques, and tools.

Algorithms An algorithm is a step by step solution to a problem. Why bother writing an algorithm? For your own use in the future. You won’t have to rethink the problem. So others can use it, even if they know very little about the principles behind how the solution was derived.

Examples of Algorithms Washing machine instructions Instructions for a ready-to-assemble piece of furniture A classic: finding the greatest common divisor (GCD) using Euclid’s Algorithm

Washing Machine Instructions Separate clothes into white clothes and colored clothes. For white clothes: Set water temperature knob to HOT. Place white laundry in tub. For colored clothes: Set water temperature knob to COLD. Place colored laundry in tub. Add 1 cup of powdered laundry detergent to tub. Close lid and press the start button.

Observations About the Washing Machine Instructions There are a finite number of steps. We are capable of doing each of the instructions. When we have followed all of the steps, the washing machine will wash the clothes and then will stop.

Refinement of Algorithm Definition Our old definition: An algorithm is a step by step solution to a problem. Adding our observations: An algorithm is a finite set of executable instructions that directs a terminating activity.

Instructions for a Ready-to-Assemble Piece of Furniture "Align the marks on side A with the grooves on Part F.“ How could these instructions be hard to follow? Which side is A? A & B look alike -- both line up with Part F! This instruction is ambiguous.

Final Version of the Algorithm Definition Our old definition: An algorithm is a finite set of executable instructions that directs a terminating activity. Final version: An algorithm is a finite set of unambiguous, executable instructions that directs a terminating activity.

History of Algorithms The study of algorithms began as a subject in mathematics. The search for algorithms was a significant activity of early mathematicians. Goal: To find a single set of instructions that can be used to solve any problem of a particular type (a general solution).

Euclid’s Algorithm Problem: Find the largest positive integer that divides evenly into two given positive integers (i.e., the greatest common divisor). Algorithm: Assign M and N the values of the larger and smaller of the two positive integers, respectively. Divide M by N and call the remainder R. If R is not 0, then assign M the value of N, assign N the value of R, and return to Step 2. Otherwise, the greatest common divisor is the value currently assigned to N.

Finding the GCD of 24 and 9 M N R 24 9 6 9 6 3 6 3 0 24 9 6 9 6 3 6 3 0 So, 3 is the GCD of 24 and 9.

Euclid’s Algorithm (con’t) Do we need to know the theory that Euclid used to come up with this algorithm in order to use it? What intelligence is required to find the GCD using this algorithm?

The Idea Behind Algorithms Once an algorithm behind a task has been discovered We don't need to understand the principles. The task is reduced to following the instructions. The intelligence is "encoded into the algorithm."

Algorithm Representation Syntax and Semantics Syntax refers to the representation itself. Semantics refers to the concept represented (i.e., the logic).

Contrasting Syntax and Semantics In the English language, we have both syntax and semantics. Syntax is the grammar of the language. Semantics is the meaning. Given the following sentence, I walked to the corner grocery store. Is this sentence syntactically correct? Is it semantically correct?

Contrasting Syntax and Semantics (con’t) Given the following sentence, I talked to the funny grocery store. Is this sentence syntactically correct? Is it semantically correct? How about I grocery store walked corner the to.

Contrasting Syntax and Semantics (con’t) Conclusion: An English sentence may be syntactically correct, yet semantically incorrect. This is also true of algorithms. And it is also true of computer code.