Introduction to Algorithms. Engineering 1D04, Teaching Session 1

Similar documents
Computers, Variables and Types. Engineering 1D04, Teaching Session 2

Objects and Classes. Engineering 1D04, Teaching Session 9

Objects and Classes Continued. Engineering 1D04, Teaching Session 10

Switch, Enumerations, Exception Handling, Recursion. Engineering 1D04, Teaching Session 12

Arrays, Type Casting and Constants. Engineering 1D04, Teaching Session 5

ITEC102 INFORMATION TECHNOLOGIES

SNS COLLEGE OF ENGINEERING,

COMP3221: Microprocessors and. Embedded Systems

O(1) How long does a function take to run? CS61A Lecture 6

Creating Java Programs with Greenfoot

ECE 202 LAB 1 INTRODUCTION TO LABVIEW

Flow Chart & Algorithms

Assessment of Programming Skills of First Year CS Students: Problem Set

Chapter 1 INTRODUCTION TO COMPUTER AND PROGRAMMING

Assessment - Unit 3 lessons 16-21

SharePoint 2013 for End Users - Microsoft Official

Interview Data: Jim Edwards

Week - 04 Lecture - 02 Merge Sort, Analysis

[MS55199]: SharePoint 2016 End User Training. Audience Profile This course is intended for new and existing users of SharePoint.

Algorithms and Data Structures Spring 2008

CCENT Study Guide. Chapter 4 Easy Subnetting

Topological Sort. Here a topological sort would label A with 1, B and C with 2 and 3, and D with 4.

SharePoint 2016 End User Training

Site Visit Protocol for Program Directors September As Program Directors prepare for the site visit, they should keep the following in mind.

Dr. Iyad Jafar. Adapted from the publisher slides

Interactive Graphics for Statistics

Introduction. The purpose of this document is to provide information for using basic HTML to create web pages by introducing the following concepts:

CS 210 Algorithms and Data Structures College of Information Technology and Engineering Weisberg Division of Engineering and Computer Science

Department of Electrical Engineering and Computer Sciences Spring 2001 Instructor: Dan Garcia CS 3 Midterm #2. Personal Information

ASQ Certification Benefits and Preparation. Presented March 14, 2017 by R.Gryniewicz and A.Ochoa-Lions Revised 2017-Mar-12

A Quick Review of Chapter 1

Programming in C++ PART 2

Lecture : Topological Space

CS270 Computer Organization Fall 2017

University of Massachusetts Amherst, Electrical and Computer Engineering

A3 Computer Architecture

Problems for Breakfast

TABLE OF CONTENTS Click on a title to go directly to the handout. Handout 1: Scale City Drive-In Shadow Puppets. Handout 2: Inverse Proportions

A fter seven hours of driving, ending with continuous twists and turns, I. By Ben Lindenbaum

Sarah Will Math 490 December 2, 2009

Alignment to the new December English Alignment. Should the outcomes change in the future, Scholastic commits to updating this alignment.

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Priority Queues / Heaps Date: 9/27/17

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Algorithms and Game Theory Date: 12/3/15

Johns Hopkins Math Tournament Proof Round: Point Set Topology

About the Tutorial. Dreamweaver MX overview

Flowchart Structure 25th October 2018

1. Consider the following code snippet. Describe what the user will see when it is executed.

System Analysis & design

SharePoint 2013 End User

Jason left at 8:15 am. He arrived at 8:30 am. How long does it take him to walk to school?

Organizing Data. Reminders. A Flood of Data. The Power of Structure...

Fundamentals of Computer Science

CISC 4090 Theory of Computation

Cardinality Lectures

Semantics via Syntax. f (4) = if define f (x) =2 x + 55.

Describing Languages with Regular Expressions

Technical Support and Diabetes Apps for DAFNE Graduates

Examples of P vs NP: More Problems

Organizing Data The Power of Structure...

Resource Allocation. Pradipta De

55031A: SharePoint 2013 End User. Sobre o curso. Destinatários. Microsoft - Sharepoint. Live Training ( também disponível em presencial )

Please Excuse My Dear Aunt Sally

Databases = Categories

Computer Basics. Logging onto Windows

MSO Lecture 1. Wouter Swierstra (adapted by HP) September 11, 2017

CMSC201 Computer Science I for Majors

COMP108 Algorithmic Foundations

The Size of the Cantor Set

CURVE SKETCHING EXAM QUESTIONS

Lecture - 8A: Subbasis of Topology

EECS 282 Information Systems Design and Programming. Atul Prakash Professor, Computer Science and Engineering University of Michigan

For Sales Kathy Hall

Using Cantor s Diagonal Method to Show ζ(2) is Irrational

Algorithms, Part 1 of 3. Problem Solving. Algorithms

Boca Raton Community High School AP Computer Science A - Syllabus 2009/10

System Software. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 13

Programmable Logic Controllers

Algorithms, Part 1 of 3

EECS 282 Information Systems Design and Programming. Atul Prakash Professor, Computer Science and Engineering University of Michigan

Week - 03 Lecture - 18 Recursion. For the last lecture of this week, we will look at recursive functions. (Refer Slide Time: 00:05)

Individual Project. Agnieszka Jastrzębska Władysław Homenda Lucjan Stapp

S/W Programming & Languages

hperry - 5/2/01 1 Real Time System Testing (MIT Lecture 31)

DEPARTMENT OF COMPUTER AND MATHEMATICAL SCIENCES UNIVERSITI TEKNOLOGI MARA CAWANGAN PULAU PINANG

RECURSION. Week 6 Laboratory for Introduction to Programming and Algorithms Uwe R. Zimmer based on material by James Barker. Pre-Laboratory Checklist

Enrico s holiday job

Network Flow. The network flow problem is as follows:

Lecture 20 : Trees DRAFT

6.001 Notes: Section 6.1

The sequence of steps to be performed in order to solve a problem by the computer is known as an algorithm.

Fundamentals of Operations Research. Prof. G. Srinivasan. Department of Management Studies. Indian Institute of Technology, Madras. Lecture No.

A Template for an Assurance Case Shall Be Known as an Assurance Case Template

Distracted Driving Prevention FedWeek: OSHA Directorate of Training and Education

Foundations, Reasoning About Algorithms, and Design By Contract CMPSC 122

Grade 7/8 Math Circles Graph Theory - Solutions October 13/14, 2015

National University of Singapore. Vision and Graphics for Special Effects. Project Proposal. 21-Feb Team Members

Settings for UPlan PC Users

UNDERSTANDING PROBLEMS AND HOW TO SOLVE THEM BY USING COMPUTERS

VISION BASICS. Introduction (note materials updated for Vision 6.8.0)

AC : USING A SCRIPTING LANGUAGE FOR DYNAMIC PROGRAMMING

Transcription:

Introduction to Algorithms Engineering 1D04, Teaching Session 1

Introductions Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 1

Course Webpage: http://elm.mcmaster.ca/ Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 2

Introduction to Algorithms Problems require solutions. The solution to a problem must be stated clearly. A clear sequence of steps for solving a specific problem is called an algorithm. Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 3

Introduction to Algorithms Task 1 Get into groups of 4 and create an algorithm to safely cross a road. Try to be as precise as possible. Some groups will get to share their algorithms. Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 4

Task 1 Problems The order in which tasks are performed is often not obvious. The individual steps themselves are often ambiguous. Often, the chicken never gets across the road. It would be nice to have a more formal way of describing the actions involved in performing a task. Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 5

Waking up!! Get Out of Bed Brush Teeth Eat Breakfast Brush Teeth Again Wash Get Dressed Put on Shoes Run to Catch Bus Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 6

Waking in the Morning Start Wash Get Dressed Get Out of Bed Brush Teeth Put on Shoes Brush Teeth Eat Breakfast Run to Catch Bus Start / Stop Box Statement Box Finish Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 7

Flowchart Elements Start / Stop Box Statement Box Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 8

Waking up!! Unfortunately, we are not all that organized. We can t all have such a structured morning experience. Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 9

Waking up!! Unfortunately, we are not all that organized. We can t all have such a structured morning experience. What if we re short on time? Does this change our decision making process? Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 10

Flowchart Elements Start / Stop Box Statement Box Decision Box Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 11

Decision Box Decision Box Are you hungry? Yes Eat breakfast No Catch bus Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 12

Waking in the Morning with Decision Start Wash Get Dressed Get Out of Bed Brush Teeth Put on Shoes Brush Teeth Eat Breakfast Run to Catch Bus Is There Extra Time? Yes Finish No Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 13

Waking in the Morning with Decision Get Out of Bed Brush Teeth If There is Extra Time Eat Breakfast Brush Teeth (Again) Wash Get Dressed Put on Shoes Run to Catch Bus Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 14

Crossing the Road Some tasks need to be repeated until a condition is satisfied. Walking can be described as move left foot forward, move right foot forward, left foot, right foot. This can be visualized by a loop in the flowchart. Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 15

Crossing the Road Are you on the other side? Yes Finish No Move Left Foot Forward Move Right Foot Forward Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 16

Crossing the Road While you re not on the other side Move Left Foot Forward Move Right Foot Forward Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 17

Introduction to Algorithms Task 2 Return to your groups. Make a flowchart for safely crossing a road and derive a natural language description from it. Be as detailed as possible. Compare it to your previous natural language description. Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 18

Algorithms What are the most important characteristics of an algorithm? Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 19

Algorithms What are the most important characteristics of an algorithm? A step-by-step procedure for solving a problem Finite number of steps Depends only on input Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 20

Algorithms Need only: sequential actions decisions while loops (iteration) Anything that is computable can be computed using just these control structures Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 21

A More Mathematical Example Let s try an algorithm that is more mathematical Do these two lines intersect? Line 1: (x 1, y 1 ) (x 2, y 2 ) Line 2: (u 1, v 1 ) (u 2, v 2 ) (same groups - work it out) Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 22

Intersecting Lines Y = mx + c Line1: m 1 = y 2 " y 1 x 2 " x 1 Line2 : m 2 = v 2 " v 1 u 2 " u 1 Line1: y 1 = m 1 x 1 + c 1 so c 1 = y 1 " m 1 x 1 Line2 : v 1 = m 2 u 1 + c 2 so c 2 = v 1 " m 2 u 1 Then solve s = m 1 r + c 1 s = m 2 r + c 2 Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 23

Intersecting Lines Y = mx + c Line1: m 1 = y 2 " y 1 x 2 " x 1 Line2 : m 2 = v 2 " v 1 u 2 " u 1 Line1: y 1 = m 1 x 1 + c 1 so c 1 = y 1 " m 1 x 1 Line2 : v 1 = m 2 u 1 + c 2 so c 2 = v 1 " m 2 u 1 Then solve s = m 1 r + c 1 s = m 2 r + c 2 What problems will you face? Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 24

Intersecting Lines Work on the problem between now and Lab 2 - you will need to solve this in that lab session. Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 25