Computer programming II. Algorithms.

Slides:



Advertisements
Similar presentations
PROBLEM SOLVING TECHNIQUES
Advertisements

For Monday Read 10.3 Homework: –Chapter 10, exercise 10.
Recursion (summary). Two Categories  Translation of recursive definition  Factorial: fact(1) = 1; fact(N) = N * fact(N-1)  Mystery: m(0) = 0; m(1)
Pseudocode and Algorithms
Tell the robot exactly how to draw a square on the board.
CS 1308 Computer Literacy and The Internet Software.
Introduction to Algorithms By Mr. Venkatadri. M. Two Phases of Programming A typical programming task can be divided into two phases: Problem solving.
Chapter 1: An Introduction to Control Structures Introduction to Programming with C++ Fourth Edition.
Algorithms, Part 2 of 3 Topics Problem Solving Examples Pseudocode
Programming Fundamentals. Thinking about Programming Robots are made to perform useful tasks. Each robot is designed to solve a specific problem, in a.
Multiple Answer Questions. Multiple Answer Question Types Look for patterns in the answers Questions with two “sets” of answers – The answer is one from.
Structured Programming (4 Credits)
Sorting Lower Bounds n Beating Them. Recap Divide and Conquer –Know how to break a problem into smaller problems, such that –Given a solution to the smaller.
Problem Solving.  Similar to Solving Math Word Problem  Read the Problem  Decide how to go about Solving the Problem  Solve the Problem  Test the.
Computer Programming Week 1: The Basics of CP 1 st semester 2012 School of Information Technology Website:
Recursion To understand recursion, you first have to understand recursion.
CMSC 104, Version 8/061L05Algorithms2.ppt Algorithms, Part 2 of 3 Topics Problem Solving Examples Pseudocode Control Structures Reading Section 3.1.
Algorithmic Thinking Chapter 10.
CS1010 Programming Methodology
Interactive Group Exercise
2008/09/22: Lecture 6 CMSC 104, Section 0101 John Y. Park
Compsci 201 Recursion, Recurrences, & Trees
Computer programming IV. Algorithms.
Algorithms, Part 2 of 3 Topics Problem Solving Examples Pseudocode
Algorithm and Ambiguity
Algorithms, Part 2 of 3 Topics Problem Solving Examples Pseudocode
UMBC CMSC 104 – Section 01, Fall 2016
Introduction to Computer Science - Alice
Loops in C C has three loop statements: the while, the for, and the do…while. The first two are pretest loops, and the the third is a post-test loop. We.
Computer programming III. Algorithms.
Ms. Capillo 7th Grade Language Arts & 6th Grade Language Arts
How do you grade students projects in programming?
Introduction to Algorithms
2008/09/22: Lecture 5 CMSC 104, Section 0101 John Y. Park
Problem Solving and Algorithms
Algorithms, Part 2 of 3 Topics Problem Solving Examples Pseudocode
Algorithms, Part 2 of 3 Topics Problem Solving Examples Pseudocode
Global Challenge Night Sensor Lesson 2.
Computational Thinking for KS3
Algorithms, Part 2 of 3 Topics Problem Solving Examples Pseudocode
Algorithms & Pseudocode & Flowcharts
Global Challenge Night Sensor Lesson 2.
Algorithms, Part 2 of 3 Topics Problem Solving Examples Pseudocode
Computer Programming.
Global Challenge Night Sensor Lesson 2.
Global Challenge Night Sensor Lesson 2.
Algorithms Key Revision Points.
Global Challenge Night Sensor Lesson 2.
Flowcharting & Algorithms
Global Challenge Night Sensor Lesson 2.
The first number is posted telling what random number was selected, I did this for testing purposes, in the real thing it would not be there. Since the.
Global Challenge Night Sensor Lesson 2.
Global Challenge Night Sensor Lesson 2.
Click to add Text Computers & Instructions. Computers are given instructions in the form of computer programs that are created through the development.
ICT Gaming Lesson 2.
Global Challenge Night Sensor Lesson 2.
Algorithms, Part 2 of 3 Topics Problem Solving Examples Pseudocode
An Introduction to Programming with C++ Fifth Edition
Computational Thinking
Global Challenge Night Sensor Lesson 2.
Basic Concepts of Algorithm
Global Challenge Night Sensor Lesson 2.
Algorithms, Part 2 of 3 Topics Problem Solving Examples Pseudocode
Algorithms, Part 2 of 3 Topics Problem Solving Examples Pseudocode
Quiz: Computational Thinking
Hour of Code Code.org/lightbot
WJEC GCSE Computer Science
Algorithms & Pseudocode & Flowcharts
WRITING AN ALGORITHM, PSEUDOCODE, AND FLOWCHART LESSON 2.
Problem Solving and Computer Programming
Presentation transcript:

Computer programming II. Algorithms

Recap: What is computer programming? Telling computers to solve a problem Think about the problem and generate a solution (algorithm) Break down the problem into step by step solution Write the solution in a language that computer can understand (coding) Algorithm for going to school in the morning

Coding Write the step by step instruction in a programming language repetition Write the step by step instruction in a programming language Scratch (https://scratch.mit.edu) sequencing conditional logic https://www.tynker.com/blog/articles/ideas-and-tips/how-to-explain-algorithms-to-kids/

Algorithm: Decision Trees Twenty questions A number between 1 and 100 A number between 1 and 1000 How many guesses do you need?

Algorithm: Decision Trees Guess a number between 0 and 7 (3 questions) X > 3 ? X > 1 ? X > 0 ? X > 2 ? X > 5 ? X > 4 ? X > 6 ? http://csunplugged.org/wp-content/uploads/2014/12/unplugged-05-information_theory.pdf

Algorithm: Decision Trees Number 0 X > 3 ? X > 1 ? X > 0 ? X > 2 ? X > 5 ? X > 4 ? X > 6 ? 1 2 3 4 5 6 7

Algorithm: Decision Trees Number 5 X > 3 ? X > 1 ? X > 0 ? X > 2 ? X > 5 ? X > 4 ? X > 6 ? 1 2 3 4 5 6 7

Coding: Decision Trees Guess a number between 0 and 3: If the number is bigger than 1 then: If the number is bigger than 2 then: The number is 3 Else: The number is 2 If the number is bigger than 0 then: The number is 1 The number is 0 X > 1? X > 0? X > 2? X = 0 X = 1 X = 2 X = 3 no yes

Coding: Decision Trees Code the previous decision tree using ScratchX (http://scratchx.org) If the number is bigger than 1 then: If the number is bigger than 2 then: The number is 3 Else: The number is 2 If the number is bigger than 0 then: The number is 1 The number is 0

ALGORITHM: PATTERN RECOGNITION

Algorithm: Pattern Recognition Rock-Paper-Scissors: Human VS Computer The computer guesses what we are going to do next based on the patterns of our previous throws http://www.nytimes.com/interactive/science/rock-paper-scissors.html

Algorithm: Pattern Recognition Fun exercise: Translate a language you don’t know Tshiluba: one of the official languages of the Democratic Republic of the Congo You are given some example sentences in Tshiluba with their English translations You will be asked to: translate English sentences into Tshiluba Translate Tshiluba sentences into English

Algorithm: Pattern Recognition bakaji bavwa bamona bana The women saw the children

Algorithm: Pattern Recognition Translate to Tshiluba: Given that the Tshiluba word for ”fruit” is cimuma and “fruits” is bimuma ; translate these to English:

Algorithm: Pattern Recognition The child: muana The children: bana The woman: mukaji The women: bakaji The man: muluma The men: baluma The lion: ntambwe The lions: bantambwe The small lions: tubantambwe The small lion: kantambwe Saw: mumona/bamona/tumona/kamona

Algorithm: Pattern Recognition Translate to Tshiluba: mbwa muluma uvwa mumona muana nzolu uvwa mumona bambwa kulu uvwa mupeta mbuji tubambuji tuvwa tupeta kana Given that the Tshiluba word for ”fruit” is cimuma and “fruits” is bimuma ; translate these to English: The fruit saw the lion The lion saw the small fruits

Next week: Algorithm: Divide and Conquer Sorting Tower of Hanoi (https://www.mathsisfun.com/games/towerofhanoi.html)

Questions?