CMSC 1041 Algorithms I An Introduction to Algorithms.

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.
The LC-3 – Chapter 6 COMP 2620 Dr. James Money COMP
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.
Thinking Mathematically
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.
1 Lecture 1: Course Overview Course: CSE 360 Instructor: Dr. Eric Torng TA: Huamin Chen.
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.
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.
Hints for homework 6.2. divisors A divisor of an integer n, also called a factor of n, is an integer which evenly divides n without leaving a remainder.
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 14 Recursion.
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.
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.
WIKIPEDIA HAS MANY MORE DIVISIBILITY RULES. EXAMPLE Since 52=13(4) is divisible by 4, is divisible by 4 Since 452=56(8)+4 is not divisible.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5: Algorithms Computer Science: An Overview Tenth Edition by J. Glenn.
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.
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.
MAT 320 Spring 2008 Section 1.2.  Start with two integers for which you want to find the GCD. Apply the division algorithm, dividing the smaller number.
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:
A. Levitin “Introduction to the Design & Analysis of Algorithms,” 3 rd ed., Ch. 1 ©2012 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Euclidean Algorithm How to find a greatest common divisor in several easy steps.
CS404 Design and Analysis of Algorithms BBy DDr. M V S Peri Sastry BB.E, PhD(BITS-Pilani)
17 November 2015Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems.
8.1 8 Algorithms Foundations of Computer Science  Cengage Learning.
Introduction to design and analysis algorithm
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.
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
Algorithms, Part 1 of 3 Topics Definition of an Algorithm
TK3043 Analysis and Design of Algorithms
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.
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.
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.
Introduction to the Design and Analysis of Algorithms
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
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.
2008/09/17: Lecture 4 CMSC 104, Section 0101 John Y. Park
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.
Programming Fundamentals (750113) Ch1. Problem Solving
Programming Fundamentals (750113) Ch1. Problem Solving
UMBC CMSC 104 – Section 01, Fall 2016
Problem Solving Skill Area 305.1
Algorithms and Problem Solving
Algorithms, Part 1 of 3 Topics Definition of an Algorithm
Programming Fundamentals (750113) Ch1. Problem Solving
Introduction to Algorithms
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.
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.
Presentation transcript:

CMSC 1041 Algorithms I An Introduction to Algorithms

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

CMSC 1043 Algorithms l An algorithm is a step by step solution to a problem l Why bother writing an algorithm ? oFor your own use in the future - Don't have to rethink the problem. oSo others can solve the problem, even if they know very little about the principles behind how the solution was derived.

CMSC 1044 Examples of Algorithms l Washing machine instructions l Instructions for a ready-to-assemble piece of furniture l A Classic: GCD - Greatest Common Divisor - The Euclidean Algorithm

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

CMSC 1046 Observations about the Washing Machine Instructions l There are a finite number of steps. l We are capable of doing each of the instructions. l When we have followed all of the steps, the washing machine will wash the clothes and then will stop. l Are all of the clothes clean ? l Do we want the washing machine to run until all of the clothes are clean ?

CMSC 1047 Refinement of the Definition l Our old definition: oAn algorithm is a step by step solution to a problem. l Adding our observations: oAn algorithm is a finite set of executable instructions that directs a terminating activity.

CMSC 1048 Instructions for a Ready-to-Assemble Piece of Furniture l "Align the marks on side A with the grooves on Part F “ l Why are these instructions typically so hard to follow ? oLack of proper tools - instructions are not executable oWhich side is A ? A & B look alike. Both line up with Part F - Ambiguous instructions.

CMSC 1049 Final Version of the Definition: An algorithm is a finite set of unambiguous, executable instructions that directs a terminating activity.

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

CMSC GCD - The Euclidean Algorithm  Assign M and N the value of the larger and the value of the smaller of the two positive integer input values, 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.

CMSC Finding the GCD or 24 and 9 MNR So 3 is the GCD of 24 and 9.

CMSC Euclidean GCD Algorithm (continued) l Do we need to know the theory that Euclid used to come up with this algorithm in order to use it ? l What intelligence is required to find the GCD using this algorithm ?

CMSC The Idea Behind Algorithms l Once an algorithm behind a task has been discovered oDon't need to understand the principles. oTask is reduced to following the instructions. oIntelligence is "encoded into the algorithm"

CMSC Algorithm Representation l Syntax and Semantics oSyntax refers to the representation itself. oSemantics refers to the concept represented.