New Mexico Computer Science For All Introduction to Algorithms Maureen Psaila-Dombrowski.

Slides:



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

MATH 224 – Discrete Mathematics
CS107 Introduction to Computer Science Lecture 2.
CS107: Introduction to Computer Science Lecture 2 Jan 29th.
1 ICS102: Introduction To Computing King Fahd University of Petroleum & Minerals College of Computer Science & Engineering Information & Computer Science.
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington Recursion COMP T1.
New Mexico Computer Science For All More Algorithms Maureen Psaila-Dombrowski.
Learning Objectives Explain similarities and differences among algorithms, programs, and heuristic solutions List the five essential properties of an algorithm.
Introduction to Analysis of Algorithms
Algorithms and Problem Solving-1 Algorithms and Problem Solving.
Algorithms and Problem Solving. Learn about problem solving skills Explore the algorithmic approach for problem solving Learn about algorithm development.
Chapter 2: Algorithm Discovery and Design
1 A Introduction to Data Structures and Algorithm Analysis Data Structures Asst. Professor Kiran Soni.
The Project AH Computing. Functional Requirements  What the product must do!  Examples attractive welcome screen all options available as clickable.
COMP An Introduction to Computer Programming : University of the West Indies COMP6015 An Introduction to Computer Programming Lecture 02.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Algorithmic Problem Solving CMSC 201 Adapted from slides by Marie desJardins (Spring 2015 Prof Chang version)
Recursion, Complexity, and Searching and Sorting By Andrew Zeng.
Invitation to Computer Science, Java Version, Second Edition.
Recursion, Complexity, and Sorting By Andrew Zeng.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 19: Searching and Sorting Algorithms.
Analysis of Algorithms
Chapter 19: Searching and Sorting Algorithms
Introduction Algorithms and Conventions The design and analysis of algorithms is the core subject matter of Computer Science. Given a problem, we want.
Chapter 13 Recursion. Learning Objectives Recursive void Functions – Tracing recursive calls – Infinite recursion, overflows Recursive Functions that.
Introduction to Algorithms By Mr. Venkatadri. M. Two Phases of Programming A typical programming task can be divided into two phases: Problem solving.
Introduction to Algorithms. What is Computer Science? Computer Science is the study of computers (??) This leaves aside the theoretical work in CS, which.
CPS120 Introduction to Computer Programming The Programming Process.
CSIS 123A Lecture 9 Recursion Glenn Stevenson CSIS 113A MSJC.
Major objective of this course is: Design and analysis of modern algorithms Different variants Accuracy Efficiency Comparing efficiencies Motivation thinking.
New Mexico Computer Science For All Algorithm Analysis Maureen Psaila-Dombrowski.
New Mexico Computer Science For All Sorting Algorithms Maureen Psaila-Dombrowski.
Lecture 11 Data Structures, Algorithms & Complexity Introduction Dr Kevin Casey BSc, MSc, PhD GRIFFITH COLLEGE DUBLIN.
CSE373: Data Structures & Algorithms Lecture 22: The P vs. NP question, NP-Completeness Lauren Milne Summer 2015.
M1G Introduction to Programming 2 3. Creating Classes: Room and Item.
1 Data Structures CSCI 132, Spring 2014 Lecture 1 Big Ideas in Data Structures Course website:
8.1 8 Algorithms Foundations of Computer Science  Cengage Learning.
ICS201 Lecture 21 : Sorting King Fahd University of Petroleum & Minerals College of Computer Science & Engineering Information & Computer Science Department.
1 Recursive algorithms Recursive solution: solve a smaller version of the problem and combine the smaller solutions. Example: to find the largest element.
1 The Software Development Process ► Systems analysis ► Systems design ► Implementation ► Testing ► Documentation ► Evaluation ► Maintenance.
INVITATION TO Computer Science 1 11 Chapter 2 The Algorithmic Foundations of Computer Science.
Design and Analysis of Algorithms & Computational Complexity CS490 Koji Tajii.
BITS Pilani Pilani Campus Data Structure and Algorithms Design Dr. Maheswari Karthikeyan Lecture1.
Introduction toData structures and Algorithms
Advanced Algorithms Analysis and Design
Algorithms and Problem Solving
Analysis of Algorithms
CSC 421: Algorithm Design & Analysis
Definition In simple terms, an algorithm is a series of instructions to solve a problem (complete a task) We focus on Deterministic Algorithms Under the.
Problem Solving Techniques
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
Algorithm Discovery and Design
Algorithm Discovery and Design
Problem Solving.
Global Challenge Walking for Water Lesson 2.
Algorithms.
Algorithms and Problem Solving
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
Chapter 13 Recursion Copyright © 2010 Pearson Addison-Wesley. All rights reserved.
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
Invitation to Computer Science 5th Edition
Presentation transcript:

New Mexico Computer Science For All Introduction to Algorithms Maureen Psaila-Dombrowski

What do these things have in common? Doing the laundry Going to the grocery store Making chocolate chip cookies  Each is an repeated action  Each follows the same steps each time you do it  Each can be thought of as an algorithm

Algorithm A set of instructions that can be used repeatedly to solve a problem or complete a task.

Why Use Algorithms? Don’t have think about the details of the problem – we already know how to solve it. ▫Once you know how to go to the grocery store, you do not need to look at a map to decide where to make the next turn. All the information is in the algorithm – just have to follow it. Same algorithm can be used ▫to sort a list whether it has 5 elements or 5000 Anyone can follow it

Computers and Algorithms Computers ▫Speed ▫Accuracy ▫Well-suited for solving tedious problems  large telephone directory  adding a long column of numbers Computers  solving problems ▫A technique for solving the problem. ▫Algorithms ▫No algorithm  no solution ▫A general case solution (in some cases)

Characteristics of an Algorithm Receives input or initial conditions Produces a result (output) Contains steps ▫Well-ordered ▫Clearly defined ▫Do-able Clear stopping point or conditions General

Already Use Algorithms Wiggle

Types of Algorithms Similar types can be grouped together ▫Highlight how a problem can be attacked or solution used ▫Different ways to group  Implementation: Iteration, deterministic, etc…  Methodology: Brute Force, Divide and Conquer,…  Application: Sorting, Searching,…

Example: Types of Algorithms Counting – counting large groups of items Sorting - puts items in a certain order in a list Searching - finding an item in a list Mapping/Graphing - solving problems related to graph theory (shortest distance, cheapest distance,…) Encryption – Encodes or decodes information Packing – how to fit the most items in a given space Maze – Creating or solving mazes

Developing an Algorithm What’s the problem? Start with input and output Abstraction and Decomposition ▫Break the problem into parts ▫Detail the steps required for each step Write the pseudo-code Refine the solution, if necessary Write the code Debug, test the code with different cases Your done!

Example Algorithm: Take the Average Input and output ▫Input – list of numbers ( 5, 10, 12, 14, 16) ▫Output – average of the list Abstraction and decomposition – what are the steps ▫Add up the numbers in the list (total) ▫Count the numbers in the list (count) ▫Average = total/count

Example Algorithm: Take the Average Write the Pseudo-Code Initialize total and count to 0 For each number in the list add that number to the total add 1 to count Divide total by count Refine if necessary – might find improvements Write the code – in the language you are using Debug – always!

Analyzing Algorithms There are many ways to solve the same problem Analyze algorithms ▫Evaluate its suitability (speed, memory needed) ▫Compare it with other possible algorithms ▫Find improvements Algorithms tend to become better during analysis ▫shorter ▫simpler ▫more elegant

Big O Used in computer science ▫When analyzing algorithms  Measure of how an algorithm runs as you increase the input size dramatically. ▫Processing time ▫Memory used ▫Another way to classify algorithms Common Big O values ▫O(n) ▫O(n log(n)) ▫O(n 2 )

Summary Algorithm - A set of instructions to solve a problem Use algorithms because  Don’t have think about the details of the problem  All the information is in the algorithm  Anyone can follow it Characteristics  Receives input and Produces a result (output)  Contains steps ▫Well-ordered ▫Clearly defined ▫Doable  Stops by itself  General Algorithm Analysis is important  Choose the best one  One analysis used is Big O notation