Algorithmic Problem Solving COMP 101 Computational Thinking and Design Thursday, September 4, 2014 Carolyn Seaman Susan Martin University of Maryland,

Slides:



Advertisements
Similar presentations
Heuristic Search techniques
Advertisements

CS107: Introduction to Computer Science Lecture 2 Jan 29th.
CSci 107 Introduction to Computer Science Lecture 1.
Computational Thinking IS 101Y/CMSC 101 September 5, 2013 Carolyn Seaman Susan Martin University of Maryland Baltimore County.
CPE702 Complexity Classes Pruet Boonma Department of Computer Engineering Chiang Mai University Based on Material by Jenny Walter.
CS 206 Introduction to Computer Science II 11 / 07 / 2008 Instructor: Michael Eckmann.
Computer Science 101 Overview of Algorithms. Example: Make Pancakes Prepare batter Beat 2 eggs Add 1 tablespoon of brown sugar Add 1 cup of milk Add 2.
CS 484 – Artificial Intelligence
CSci 107 Introduction to Computer Science Lecture 1.
Programming Concepts (Part A) Ping Hsu. What is a program? WHITE CAKE RECIPE 1.Preheat oven to 350 degrees F (175 degrees C). 2.Grease and flour a 9x9.
CS 206 Introduction to Computer Science II 11 / 10 / 2008 Instructor: Michael Eckmann.
Analysis of Algorithms CS 477/677
Data Flow Analysis Compiler Design Nov. 8, 2005.
The Design and Analysis of Algorithms
Chapter 2: Algorithm Discovery and Design
Chapter 3 Planning Your Solution
Adapted from slides by Marie desJardins
COMP An Introduction to Computer Programming : University of the West Indies COMP6015 An Introduction to Computer Programming Lecture 02.
Abstraction IS 101Y/CMSC 101 Computational Thinking and Design Tuesday, September 17, 2013 Carolyn Seaman University of Maryland, Baltimore County.
Programming & Data Structures
1 Introduction to Approximation Algorithms. 2 NP-completeness Do your best then.
Clearing Algorithms for Barter Exchange Markets: Enabling Nationwide Kidney Exchanges Hyunggu Jung Computer Science University of Waterloo Oct 6, 2008.
Algorithmic Problem Solving CMSC 201 Adapted from slides by Marie desJardins (Spring 2015 Prof Chang version)
Graph Theory Topics to be covered:
Lecture 2 Fundamental Data Types. Variable Declaration.
Banana Pudding By: Sara Bottoms & Jessica Davis. Our Recipe Ingredients ¾ cup granulated sugar ¼ teaspoon salt ½ cup all- purpose flour 3 cups low- fat.
Representing and Using Graphs
Abstraction IS 101Y/CMSC 101 Computational Thinking and Design Tuesday, September 17, 2013 Marie desJardins University of Maryland, Baltimore County.
The Algorithmic Model. What is Computer Science What is Programming Algorithms –Definition –Properties of Good Algorithms –Describing Algorithms –Examples.
Instructional Video Read the Recipe Select Ingredients And Equipment Prepare The Recipe BAKING COOKIES IN THE VIRTUAL WORLD HELP About LO.
Abstraction IS 101Y/CMSC 101 Computational Thinking and Design Tuesday, September 9, 2014 Carolyn Seaman Susan Martin University of Maryland, Baltimore.
Introduction to Algorithms By Mr. Venkatadri. M. Two Phases of Programming A typical programming task can be divided into two phases: Problem solving.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
Data Structures and Algorithms Introduction to Algorithms M. B. Fayek CUFE 2006.
Algorithmic Problem Solving: Programming with Processing IS 101Y/CMSC 101 Computational Thinking and Design Thursday, September 11, 2014 Carolyn Seaman.
Algorithms & Flowchart
 What is Modeling What is Modeling  Why do we Model Why do we Model  Models in OMT Models in OMT  Principles of Modeling Principles of Modeling 
Computer Science 101 Introduction.
The Software Development Process
Beauty and Joy of Computing Limits of Computing Ivona Bezáková CS10: UC Berkeley, April 14, 2014 (Slides inspired by Dan Garcia’s slides.)
WK15. Vertex Cover and Approximation Algorithm By Lin, Jr-Shiun Choi, Jae Sung.
Computational Thinking IS 101Y/CMSC 101 September 5, 2013 Marie desJardins University of Maryland Baltimore County.
Algorithmic Problem Solving IS 101Y/CMSC 101 Computational Thinking and Design Tuesday, September 10, 2013 Marie desJardins University of Maryland, Baltimore.
Introduction to Programming in VB Chapter 1. 2 Software Development Life Cycle Gather Requirements Design Program Code & Test Program Implement u Software.
Graphs A ‘Graph’ is a diagram that shows how things are connected together. It makes no attempt to draw actual paths or routes and scale is generally inconsequential.
Strings Basic data type in computational biology A string is an ordered succession of characters or symbols from a finite set called an alphabet Sequence.
Introduction to design and analysis algorithm
1 The Software Development Process ► Systems analysis ► Systems design ► Implementation ► Testing ► Documentation ► Evaluation ► Maintenance.
Computer Science 111 Fundamentals of Programming I Introduction.
1 Introduction to design and analysis algorithm. 2.
Cream Puff & Pudding Lab. 1. Preheat oven to 400  F. 2. Bring butter, water, and salt to a boil over medium heat in a 2 qt. saucepan. 3.Add flour all.
How to Make a Cake Mrs. Janasik.
Algorithmic Problem Solving: Programming with Processing IS 101Y/CMSC 101 Computational Thinking and Design Thursday, September 12, 2013 Carolyn Seaman.
CSci 107 Introduction to Computer Science
Maple Peanut Butter Thumbprint Cookies
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
Click to add Text Computers & Instructions. Computers are given instructions in the form of computer programs that are created through the development.
Optimization 薛智文 (textbook ch# 9) 薛智文 96 Spring.
Algorithms vs. Programming
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.
Global Challenge Walking for Water Lesson 2.
Algorithms vs. Programming
Presentation transcript:

Algorithmic Problem Solving COMP 101 Computational Thinking and Design Thursday, September 4, 2014 Carolyn Seaman Susan Martin University of Maryland, Baltimore County

Coding.org

Important Problems Hunger Poverty Disease Inequality Traffic War Climate change Population growth Education Lack of technology Dependence on technology Racial conflict Homelessness Pollution Energy

A Kidney Story Kidney disease affects 50,000 new Americans a year A great example of computational abstraction! Pairs Cycles Chains Two cycleThree cycle

A Big Kidney Story What about really big chains? How do you come up with an optimal series of swaps? Exercise taken from: NY Times, Feb 19, 2012

Kidney Exchange Consider the exchange below. A patient is connected to a donor if they are biologically compatible. A donor will only donate a kidney if his or her friend also receives a kidney. What is the optimal exchange for this situation? Why? What technique did you use to solve this problem? How would your technique scale if there were ten donors and patients? 100? Thousands?

Alternative Representation A graph data structure can capture the important relationships among patients and donors In the graph, there is an edge from one node to another if and only if the first node can receive a kidney from the second node. This representation is an abstraction of the matching problem In reality, the problem is more complex – edges are labeled with weights that represent the degree/quality of the match A legal exchange is a path that never visits any vertex twice A cycle returns to the starting vertex; a chain does not If every node was visited (every patient received a kidney and every donor donated one), this would be called a Hamiltonian cycle Discovering a Hamiltonian cycle is a famous NP-complete (i.e., computationally hard) problem What is the longest legal chain in this graph? Longest legal cycle?

Algorithms An algorithm is an ordered set of unambiguous steps that describes a process Examples from real life: Recipes Project directions - chemistry lab, writing prompt Instruction manual (IKEA) Construction/building anything Scientific method Deciding what you want for lunch Krebbs cycle (breathing/photosynthesis) Medical protocols

Algorithms Express Solutions to Computational Problems Algorithms are expressed and implemented using languages Possibilities: natural language, pseudocode, visual and textual programming languages Different languages may be more suitable for solving different problems The choice of language can affect clarity or readability, but not whether a solution exists Algorithms can solve many, but not all, problems Many problems can be solved in a reasonable time Some require heuristic (approximate) approaches to solve them in a reasonable time Some problems cannot be solved using any algorithm Algorithms are evaluated analytically and empirically. Many possible criteria (e.g., efficiency, correctness, usability,...) Different algorithms for the same problem can have different measurements for these criteria

Friendship Sheldon’s Friendship Algorithm Sheldon’s Friendship Algorithm

Your Examples How to make a sandwich How to change a tire Getting ready in the morning Getting to class Make up tutorials GPS Installing a videogame

Algorithms: Syntax and Semantics Before you can write an algorithm, you have to have a language in which to express it Basic components of every algorithmic language: “Primitive” actions Conditionals: if then Loops: repeat until Variables: places to store information Input and output: ways to get information into the algorithm and to return information to the invoker Functions: ways to group instructions into a “macro- action” or “subgoal”

7 1/2 T all purpose flour 1 1/2 C milk 1 1/2 C butter 1 1/2 C granulated sugar 3/8 t salt 3 t vanilla Blend flour and milk until smooth. Cook over medium heat until very thick. Stir constantly. Cool. Cream butter at medium speed. Add sugar gradually, 1/4 C at a time. Add milk mixture. Beat until smooth and fluffy. Add salt and vanilla. Beat well. Whipped Butter Frosting Is this a reasonable primitive action? (for Julia Child? for a 5-year-old?) Here’s a loop termination condition... What’s the termination condition?? Is this a reasonable primitive action? Maybe it should be written as a loop...

Peanut Butter and Jelly In your group, write an algorithm to make a peanut butter and jelly sandwich. What could possibly go wrong?

Processing Language for programming graphical and interactive computations

Processing Demonstration “My Crazy Squares” by Marcella Todaro CrazySquares.pde

Reminders