Rocky K. C. Chang September 11, 2018

Slides:



Advertisements
Similar presentations
Heuristic Search techniques
Advertisements

Chapter 10 Algorithmic Thinking. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Learning Objectives List the five essential.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
Abstract Data Types (ADT)
Recursion.
1. By the end of this lecture you should be able … To describe in general terms how computers function To describe the fetch-execute cycle To explain.
1 Shortest Path Calculations in Graphs Prof. S. M. Lee Department of Computer Science.
Introduction to Programming (in C++) Recursion Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer Science, UPC.
Copyright © Cengage Learning. All rights reserved.
CONFIDENTIAL1 Good Afternoon! Today we will be learning about Functions Let’s warm up : Evaluate the following equations: 1) a + 4 = 9 2) b - 4 = 9 3)
Towers of Hanoi. Introduction This problem is discussed in many maths texts, And in computer science an AI as an illustration of recursion and problem.
Recursion Chapter 7 Copyright ©2012 by Pearson Education, Inc. All rights reserved.
1 State Space of a Problem Lecture 03 ITS033 – Programming & Algorithms Asst. Prof.
Goals of Course Introduction to the programming language C Learn how to program Learn ‘good’ programming practices.
13.2 Recursive Definitions Objective 1) Provide the recursive definition for sequences; 2) Identify the type of a sequence from a recursive definition.
Introduction Algorithms and Conventions The design and analysis of algorithms is the core subject matter of Computer Science. Given a problem, we want.
ENM 503 Lesson 1 – Methods and Models The why’s, how’s, and what’s of mathematical modeling A model is a representation in mathematical terms of some real.
Algorithms CS139 – Aug 30, Problem Solving Your roommate, who is taking CS139, is in a panic. He is worried that he might lose his financial aid.
Algorithms for Addition and Subtraction. Children’s first methods are admittedly inefficient. However, if they are free to do their own thinking, they.
CSE 2320 Algorithms and Data Structures Dimitrios Kosmopoulos Introduction.
CENG112: Data Structures 1. Text Book "Data Structures" by Richard F. Gilberg & Behrouz A. Forouzan, 2nd Edn., Thomson Course Technology, 2006, ISBN 13:
Data Structure and Algorithms. Algorithms: efficiency and complexity Recursion Reading Algorithms.
Program Design. The design process How do you go about writing a program? –It’s like many other things in life Understand the problem to be solved Develop.
Alternative Algorithms for Addition and Subtraction If we don’t teach them the standard way, how will they learn to compute?
WHAT IS COMPUTATION? Rocky K. C. Chang August 31, 2015.
PROBLEM-SOLVING TECHNIQUES Rocky K. C. Chang November 10, 2015.
Knowledge Representation Fall 2013 COMP3710 Artificial Intelligence Computing Science Thompson Rivers University.
 Tower of Hanoi – Link 1 Tower of Hanoi – Link 1  Tower of Hanoi – Link 2 Tower of Hanoi – Link 2.
7. RECURSIONS Rocky K. C. Chang October 12, 2015.
Please sit in grade level groups. Grade 1 Grade 2 Grade 3Grade 4 Grade 5 Grade 6.
1 Introduction to Turing Machines
CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 9: The Tower of Hanoi.
Chapter 12 Theory of Computation Introduction to CS 1 st Semester, 2014 Sanghyun Park.
#1 Make sense of problems and persevere in solving them How would you describe the problem in your own words? How would you describe what you are trying.
Computer Systems Architecture Edited by Original lecture by Ian Sunley Areas: Computer users Basic topics What is a computer?
5. Algorithm 1: Variables, Operators, Sequences 1.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Recursion,
Year 9 Mathematics Algebra and Sequences
Automatic Test Generation
Knowledge Representation
Decision Support Systems
Chapter 16: Sample Size “See what kind of love the Father has given to us, that we should be called children of God; and so we are. The reason why the.
KS2 Maths Workshop for parents
Properties of Operations
Computer Science Programming Chapter 1, Sections
Using Algorithms Copyright © 2008 by Helene G. Kershner.
Algorithm Analysis CSE 2011 Winter September 2018.
Introduction to Computer Programming
RELATIONS AND FUNCTIONS
Algorithm and Ambiguity
Introduction (with applications) ADT & terminology
Teach A level Computing: Algorithms and Data Structures
Productive Mathematical Discussions: Working at the Confluence of Effective Mathematics Teaching Practices Core Mathematics Partnership Building Mathematical.
Chapter 9 TURING MACHINES.
Using Algorithms Copyright © 2008 by Helene G. Kershner.
Binary Search Trees One of the tree applications in Chapter 10 is binary search trees. In Chapter 10, binary search trees are used to implement bags.
Theory of Computation Turing Machines.
4. Computational Problem Solving
Programming We have seen various examples of programming languages
Algorithm and Ambiguity
Scientific Method The 7-step process to scientific investigations.
Algorithms.
Introduction to Data Structures
Algorithms and Problem Solving
Knowledge Representation
Rocky K. C. Chang September 11, 2018
Lecture One: Automata Theory Amjad Ali
ECE 352 Digital System Fundamentals
Lecture 6 - Recursion.
Presentation transcript:

Rocky K. C. Chang September 11, 2018 What is computation? Rocky K. C. Chang September 11, 2018

Goals Understand how complex procedures can be developed from simple procedures. Understand three different ways of defining computations. Understand that problem solving involves (1) abstraction, (2) algorithm design, and (3) implementation.

A simple example: What is 53357 + 1897 + 764274 + …?

Let’s take a CS approach.

0. How to add 2 digits?

We start with an addition table.

PROC0 If we are given two digits (0, 1, …, 9), we look up the addition table to get the result which consists of two digits. The left digit is 0 if the result is less than 10.

1. How to add 3 digits?

2. How to add two multidigit numbers?

3. How to add any list of numbers?

Moreover, We could do similar things for subtraction. With addition and subtraction, we could do multiplication and division. We could then use two numbers to represent rational numbers. We could use those numbers in systems of equations, matrices … Take-away #1: Starting with simple symbolic operations (such as table lookup), one can assemble the operations into ever larger procedures and develop an extremely wide range of behaviors as computational processes. Take-away #2: Any machines that can perform PROC0 can perform other procedures.

Now we replace the addition table by

A new symbolic computation We could develop the same procedures as before but with the digits replaced by the alphabets. A key observation: “To produce meaningful answers, you do not have to understand what the symbols stand for or why the manipulations are correct.” (Levesque) The “trick” of computation: “Computers can perform a wide variety of impressive activities precisely because those activities can be described as a type of symbol processing that can be carried out purely mechanically.” (Levesque)

What is computation? “Computation is the process of taking symbolic structures, breaking them apart, comparing them, and reassembling them according to a precise recipe called a procedure.” (Levesque) Examples of symbolic structures: 123 + 321 256 + (x – 1)2 I love computer science. What we have defined so far is so called the functional model. Read an input. Compute. Write an output.

Another model (Horswill) An imperative model: procedures are sequence of commands that manipulate (symbolic) representations. (Horswill)

Human (based/assisted) computation CAPTCHA: Completely Automated Public Turing test to tell Computers and Humans Apart (a YouTube video)

Ex. 1: A Man, Cabbage, Goat, Wolf problem

Ex. 1: The problem The problem: Bring the cabbage, goat and wolf from the East side of the river to the West side. Constraints: The man can bring only the cabbage, goat or wolf at any time. The cabbage cannot stay with the goat alone. The goat cannot stay with the wolf alone.

Ex. 1: Abstraction (or data modeling) After understanding the problem, the next step is to abstract the problem. Abstraction is a representation of a problem with just enough important details. For our problem, we assign East (E) or West (W) to the man, cabbage, goat and wolf: Man: E/W Cabbage: E/W Goat: E/W Wolf: E/W [E/W, E/W, E/W, E/W] for [man, cabbage, goat, wolf]. The problem is to bring [E, E, E, E] to [W, W, W, W] without losing the cabbage and goat.

Ex. 1: Designing a solution (algorithm) Starting from [E, E, E, E] Try the three possible moves: [E, E, E, E]  [W, W, E, E] [E, E, E, E]  [W, E, W, E] [E, E, E, E]  [W, E, E, W] On the return trip, [W, W, E, E]  [E, W, E, E] [W, E, W, E]  [E, E, W, E] [W, E, E, W]  [E, E, E, W] Now we are back to the East side, repeat the steps. Find the ones that meet the solution requirements.

Ex. 2: Examination timetabling Problem: Schedule all courses' examinations to different time slots. Constraints: Two exams cannot be scheduled on the same time slot, if at least one student is taking both.

Ex. 2: Abstraction Model each course's exam as a node. Put an edge between two nodes if there is at least one student is taking both exams. For example, The problem is to remove nodes that have no edges among them until no more nodes to remove.

Ex. 2: Designing a solution (algorithm) Given a course-conflict graph, finding an independent set and removing them from the graph. An independent set is a collection of nodes that have no connecting edges within the collection. For the first time, we could remove Econ and Phy and schedule them on the same time slot. Better yet, we could remove Econ, Phy and Eng OR Econ, Phy and Math. This is call the maximal independent set. Repeat the procedure for the two remaining nodes until nothing is left.

Ex. 3: Tower of Hanoi Problem: To move a stack of n disks from pole A to pole B, subjecting to 2 rules: Only one disk can be moved at a time. A larger disk can never go on top of a smaller one.

Ex. 3: Abstraction Each disk has a unique size. For each pole, remember the disks there. For each move, you can check whether the move is legal or not.

Ex. 3: Designing a solution (algorithm) n = 1, trivial n = 2, trivial again n = 3: trivial to some people? n = 4: trivial to fewer people? n = 64? A smarter approach using recursive thinking Move the largest disk from A to B. Assume we could move the top n-1 disks from A to C. Repeat the procedure for the second largest disk (from C to B). How many moves do we need? 2n - 1

Think recursively

Think recursively

What are common across the three examples? We need some data representation (i.e., abstraction) Help formulate the problem to be solved by computers. Sometimes, the abstraction helps us identify the key problem (e.g., the exam timetabling problem). We need (correct and efficient) algorithms to solve the problems. An algorithm is a procedure for solving a mathematical problem in a finite number of steps that frequently involves repetition of an operation; (broadly) a step-by-step procedure for solving a problem or accomplishing some end especially by a computer. An algorithm often involves repeating the same set of operations. Some problems are too complex to solve even with correct algorithms.

What are common across the three examples? (cont'd) Computing is the automation of our abstractions. Automation is mechanizing our abstractions, abstraction layers, and their relationships. Computational thinking involves choosing the right abstractions and choosing the right “computer” for the task. “The computer is incredibly fast, accurate, and stupid. Man is unbelievably slow, inaccurate, and brilliant. The marriage of the two is a force beyond calculation” (Leo Cherne).

Conclusions Computation is not just calculation of numbers. Computation involves abstraction and mechanization of abstraction. Computation involves procedures of manipulating symbolic representations which could be a list of records, a graph of objects, and so on. Computers, though very powerful, cannot solve some problems that human can.

Self study Watch a YouTube video on what IBM does on computational biology. Watch a YouTube video on human computation.

Acknowledgments for the sources Hector Levesque. 2012. Thinking as Computation a First Course. MIT Press, Cambridge, MA, USA. (electronic copy in the PolyU library) Ian Horswill. 2008. “What is computation?” Jeannette M. Wing, "Computational Thinking," Commun. of the ACM, vol. 49, March 2006. Charles Dierbach. 2013. Introduction to Computer Science Using Python. Wiley. (pdf copy in the Internet) Al Aho and Jeff Ullman. 1994. Foundations of Computer Science. W. H. Freeman. (a hardcopy in PolyU)

END