Processing & Java An Introduction to Computing. © Calvin College, 2009 2 Computer Science is no more about computers than astronomy is about telescopes.

Slides:



Advertisements
Similar presentations
Bellman-Ford algorithm
Advertisements

CS107: Introduction to Computer Science Lecture 2 Jan 29th.
CSci 107 Introduction to Computer Science Lecture 1.
CS 262 Software Engineering Keith Vander Linden Calvin College.
1 Theory I Algorithm Design and Analysis (10 - Shortest paths in graphs) T. Lauer.
1 CS1000 Introduction to Computer Science Instructor Soufiane Noureddine Lectures Tu/Th: 12:15-13:30 (B650) Office Hours Tu/Th: 11:00-12:00 (C520)
CS 206 Introduction to Computer Science II 11 / 07 / 2008 Instructor: Michael Eckmann.
Computer Software & Software Development H&K Chapter 1 Instructor – Gokcen Cilingir Cpt S 121 (June 20, 2011) Washington State University.
Algorithms and Problem Solving-1 Algorithms and Problem Solving.
CSE 421 Algorithms Richard Anderson Dijkstra’s algorithm.
CSci 107 Introduction to Computer Science Lecture 1.
Algorithms and Problem Solving. Learn about problem solving skills Explore the algorithmic approach for problem solving Learn about algorithm development.
CS 206 Introduction to Computer Science II 11 / 10 / 2008 Instructor: Michael Eckmann.
Greedy Algorithms Reading Material: Chapter 8 (Except Section 8.5)
Graph Algorithms: Shortest Path We are given a weighted, directed graph G = (V, E), with weight function w: E R mapping.
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.
Greedy Algorithms Like dynamic programming algorithms, greedy algorithms are usually designed to solve optimization problems Unlike dynamic programming.
CS 206 Introduction to Computer Science II 03 / 30 / 2009 Instructor: Michael Eckmann.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Design and Analysis of Algorithms - Chapter 11 Algorithm An algorithm is a.
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.
TECH Computer Science Graph Optimization Problems and Greedy Algorithms Greedy Algorithms  // Make the best choice now! Optimization Problems  Minimizing.
Theory of Computing Lecture 7 MAS 714 Hartmut Klauck.
Introduction Dr. Ying Lu RAIK 283: Data Structures & Algorithms.
Nattee Niparnan Dept. of Computer Engineering, Chulalongkorn University.
PROCESSING Designing and developing a program. Objectives Understand programming as the process of writing computer instructions that achieve a goal Understand.
1 Shortest Path Problem Topic 11 ITS033 – Programming & Algorithms C B A E D F Asst. Prof. Dr. Bunyarit Uyyanonvara IT Program,
Dijkstras Algorithm Named after its discoverer, Dutch computer scientist Edsger Dijkstra, is an algorithm that solves the single-source shortest path problem.
Lecture 12-2: Introduction to Computer Algorithms beyond Search & Sort.
1 CPSC 185 Introduction to Computing The course home page
Introduction to Algorithms. What is Computer Science? Computer Science is the study of computers (??) This leaves aside the theoretical work in CS, which.
Major objective of this course is: Design and analysis of modern algorithms Different variants Accuracy Efficiency Comparing efficiencies Motivation thinking.
CS 312: Algorithm Analysis Lecture #1: Algorithms and Efficiency This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.Creative.
Design & Analysis of Algorithms Lecture 1 Introduction.
Design and Analysis of Algorithms - Chapter 11 Algorithm b An algorithm is a sequence of unambiguous instructions for solving a problem, i.e., for obtaining.
Algorithms 1.Notion of an algorithm 2.Properties of an algorithm 3.The GCD algorithm 4.Correctness of the GCD algorithm 5.Termination of the GCD algorithm.
UNIT-I INTRODUCTION ANALYSIS AND DESIGN OF ALGORITHMS CHAPTER 1:
CSEP 521 Applied Algorithms Richard Anderson Winter 2013 Lecture 3.
Chapter 20: Graphs. Objectives In this chapter, you will: – Learn about graphs – Become familiar with the basic terminology of graph theory – Discover.
Dijkstra animation. Dijksta’s Algorithm (Shortest Path Between 2 Nodes) 2 Phases:initialization;iteration Initialization: 1. Included:(Boolean) 2. Distance:(Weight)
1.  A step by step process to solve any problem is called algorithm.  Algorithm is a process which take some values as input and provide us output.
Introduction to Problem Solving Programming is a problem solving activity. When you write a program, you are actually writing an instruction for the computer.
Systems in the Small: An Introduction to Algorithms David Millard
Advanced Algorithms Analysis and Design
Introduction to Algorithms
Algorithms and Problem Solving
By Laksman Veeravagu and Luis Barrera
TK3043 Analysis and Design of Algorithms
Chapter 1 Introduction Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
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.
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.
Objective of This Course
CSci 107 Introduction to Computer Science
Algorithms and Problem Solving
Introduction to Algorithms
Unit 3 lesson 2-5 The Need For Algorithms- Creativity in Algorithms – Simple Commands - Functions Day 18.
Algorithms Algorithm. [webster.com] A procedure for solving a mathematical problem (as of finding the greatest common divisor) in a finite number of steps.
Algorithm: Word comes from Arabic Author Abū ‘Abdallāh Muḥammad ibn Mūsā al-Khwārizmī Algorism Algebra: Kitab al-Mukhtasar fi Hisab al-Jabr wal-Muqabala.
Graph Algorithms: Shortest Path
CSE 417: Algorithms and Computational Complexity
Introduction to Algorithms
Chapter 1 Introduction Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Welcome to the most Amazing course there is 
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:

Processing & Java An Introduction to Computing

© Calvin College, Computer Science is no more about computers than astronomy is about telescopes. - attributed to E.W. Dijkstra

© Calvin College, Write a set of instructions for distributing a brownie from a pan to each student in the class who wants one. Note the following: Be detailed enough for an unimaginative, forgetful, myopic, clueless instructor to execute correctly. Be clear about your assumptions. Be general with respect to different class sizes and different pan dimensions. Work in teams and write your instructions out on paper. Exercise

© Calvin College, Introduction ● The course home page ● Computing Computing – Algorithms Algorithms – Data Structures Data Structures – Examples Examples ● Processing Processing ● Software Engineering Software Engineering ● A Broader Perspective A Broader Perspective

© Calvin College, Computing ● Computing is not: – The study of computers – The study of how to write programs – The study of computer applications ● Computing is the study of algorithms, where an algorithm is a procedure that solves a problem using an ordered, unambiguous, finite set of operations.

© Calvin College, Muhammad ibn Musa al'Khwarizmi ( ) Algorithms image from Persian mathematician famous for: – Introducing base-10 numbering to the west – Writing Kitab al jabr w’al muqabala (The Rules of Restoration and Reduction) – Specifying finite, ordered, and unambiguous operations for solving problems, i.e., algorithms.

© Calvin College, Algorithms ● Algorithms are powerful constructs used in problem solving. ● To be computed, they must have the following properties: – Finite – Ordered – Unambiguous

© Calvin College, Operations ● The operations used in algorithms are primitive tasks that can be executed. ● Primitive operations are the “basic” operations in the application domain, e.g., basic arithmetic, drawing graphical shapes.

© Calvin College, Control Structures ● Control structures specify the ordering of the operations in the algorithm. ● There are three basic control structures: – Sequence – Selection – Repetition

© Calvin College, Sequence ● A sequence of multiple operations is executed in order. Pattern: operation 1 operation 2 … operation n ● Example:

© Calvin College, Selection ● Selective operations are executed conditionally. Pattern: if condition then set of operations 1 else set of operations 2 ● Example:

© Calvin College, Repetition (list version) ● Repetitive operations are executed iteratively. Some repetitive operations process lists of items. Pattern: Repeat for each list element set of operations on current element Go on to next list element ● Example:

© Calvin College, Repetition (conditional version) ● Some repetitive operations are conditional. Pattern: Repeat while condition set of operations Go on to next iteration ● Example:

© Calvin College, Euclid of Alexandria ( BC) The Elements Euclid’s Algorithm finds the greatest common divisor of two positive natural numbers, a & b (where a ≥ b). Images from www-groups.dcs.st-andrews.ac.uk & wikipedia.org

© Calvin College, Example: Euclid’s Algorithm Test Cases: GCD(36,16) → 4; GCD(1,1) → 1; GCD(1260,198) → 18 Given: Two positive natural numbers a & b Set remainder = some non-zero value Repeat these steps until remainder = 0 Set remainder = the remainder of a divided by b If remainder = 0 Then Print GCD is b Else Set a = b and b = remainder Go on to the next repetition

© Calvin College, Designing Algorithms ● Algorithms addressing myriad problems can be designed by recursively using a reasonable set of computable operations and the three control structures.

© Calvin College, Data Structures ● Algorithms operate on data. ● An algorithm must be precise about the abstract data structures that it manipulates.

© Calvin College, Shortest Path Problems ● SP problems find a path between two points with minimum total weight. ● Given graph G, starting point KH & destination CDH, the shortest path is 595 yards G

© Calvin College, Edsger Dijkstra ( ) Shortest Path Algorithm Dijkstra’s algorithm solves the single-source shortest path problem for a graph with nonnegative edge weights. Numerische Mathematik (1959), p. 269–271 images from www-b2.is.tokushima-u.ac.jp &

© Calvin College, Example: Dijkstra’s Algorithm Test Cases:, Given: A weighted graph – G(vertexes, edges) A current starting vertex – v set D[v]=0 repeat for each vertex u≠v of G set D[u] = +∞ set Q = priority queue of G’s edges based on weights repeat while Q is not empty set u = minimum distance vertex in Q repeat for each vertex v in Q adjacent to u if D[u]+weight(u,z)<D[z] then set D[z] = D[u]+weight(u,z) set Q(z).key = D[z]

© Calvin College, Example: Brownies

© Calvin College, Example: Card Sorting

© Calvin College, Processing IDE

© Calvin College, Example: Random Dots

© Calvin College, ● Processing, 2001 ● Developed by Reas & Fry when they were PhD students at the Aesthetics and Computation Group at the MIT Media Lab ● Designed for electronic arts and visual design Casey Reas ( ) & Ben Fry ( ) “Dancing Spirals” by Ira Greenberg images from albagcorral.com and iragreenberg.com/ What’s the Big Idea

© Calvin College, Software Engineering ● The goal of software engineering is to produce systems that have the following characteristics: - The algorithm and data structures solve the problem correctly and efficiently. - The encoded algorithm is understandable. - The resulting system is usable. ● Achieving this for large problems requires creativity and ingenuity.

© Calvin College, The Development Life-Cycle Realistic problems tend to be large enough to require the disciplined effort of multiple people, coordinated into phases: – Analysis; – Design; – Implementation; – Testing; – Maintenance.

© Calvin College, Sequential Development The software development life-cycle is traditionally viewed sequentially. Analysis Implementation Testing Maintenance Design

© Calvin College, Iterative/Incremental Development Agile development tends to use a more iterative and incremental model. Design Testing Implementation Analysis

© Calvin College, Fredrick P. Brooks (1931- ) The Mythical Man-Month What’s the Big Idea Joys of programming We enjoy designing things because we are created in the image of God. The computer is a powerful and rewarding tool to use. Woes of programming The “mindless” details can be excessively tedious. Products become obsolete too quickly. As the child delights in his mud pie, so the adult enjoys building things, especially things of his own design. I think this delight must be an image of God's delight in making things, a delight shown in the distinctness and newness of each leaf and each snowflake. - F. P. Brooks, Jr. The Mythical Man-Month, 1975 images from: