Creativity in Algorithms

Slides:



Advertisements
Similar presentations
The LC-3 – Chapter 6 COMP 2620 Dr. James Money COMP
Advertisements

Learning Objectives Explain similarities and differences among algorithms, programs, and heuristic solutions List the five essential properties of an algorithm.
Slides prepared by Rose Williams, Binghamton University Chapter 3 Flow of Control Loops in Java.
9-Aug-15 Vocabulary. Programming Vocabulary Watch closely, you might even want to take some notes. There’s a short quiz at the end of this presentation!
Bug Session Four. Session description Objectives Session activities summary Resources Prior knowledge of sequencing instructions using Bug Bug website.
“The study of algorithms is the cornerstone of computer science.” Algorithms Fall 2011.
CMP-MX21: Lecture 5 Repetitions Steve Hordley. Overview 1. Repetition using the do-while construct 2. Repetition using the while construct 3. Repetition.
Introduction to Loops For Loops. Motivation for Using Loops So far, everything we’ve done in MATLAB, you could probably do by hand: Mathematical operations.
The Beauty and Joy of Computing Lecture #6 Algorithms I UC Berkeley EECS Sr Lecturer SOE Dan Garcia.
ITEC 109 Lecture 11 While loops. while loops Review Choices –1 st –2 nd to ?th –Last What happens if you only use ifs? Can you have just an else by itself?
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 4: Introduction to C: Control Flow.
Flow Control in Imperative Languages. Activity 1 What does the word: ‘Imperative’ mean? 5mins …having CONTROL and ORDER!
11 Making Decisions in a Program Session 2.3. Session Overview  Introduce the idea of an algorithm  Show how a program can make logical decisions based.
The Beauty and Joy of Computing Lecture #6 Algorithms I Jon Kotker UC Berkeley EECS 2010, 2013 Microsoft
BIT116: Scripting Lecture 05
The Need for Algorithms
Creativity of Algorithms & Simple JavaScript Commands
Recursion Topic 5.
AP CSP: The Need for Programming Languages and Algorithms
Vocabulary Algorithm - A precise sequence of instructions for processes that can be executed by a computer Low level programming language: A programming.
High or Low Level Programming Language? Justify your decision.
Programming & Scratch.
AP Computer Science Principles
Unit 3: Lesson 1 - The Need for Programming Languages
UNIT 2 – LESSON 3 Encoding B&W Images.
Week 9 - Monday CS 113.
Unit 3 lesson 2&3 The Need For Algorithms- Creativity in Algorithms
Creativity in Algorithms
Programming Mehdi Bukhari.
A451 Theory – 7 Programming 7A, B - Algorithms.
Chapter 5 Decisions. Chapter 5 Decisions ssential uestion: How are Boolean expressions or operators used in everyday life?
The Need for Programming Languages
The Need for Algorithms 2 days
Vocabulary Algorithm - A precise sequence of instructions for processes that can be executed by a computer.
Lesson 9: "if-else-if" and Conditional Logic
Algorithm and Ambiguity
Chapter 5 Structures.
LESSON 11 – WHILE LOOPS UNIT 5 – 1/10/17.
Lesson 8: Boolean Expressions and "if" Statements
Learning to Program in Python
Lesson 2 Programming constructs – Algorithms – Scratch – Variables Intro.
Scratch: selection / branching/ if / If…else / compound conditionals / error trapping by Mr. Clausen.
Lesson 15: Processing Arrays
UNIT 3 CHAPTER 1 LESSON 4 Using Simple Commands.
Creating Functions with Parameters
Theory of Computation Turing Machines.
HAPPY NEW YEAR! Lesson 7: If-statements unplugged
Looping and Random Numbers
This Lecture Substitution model
Loops CIS 40 – Introduction to Programming in Python
Coding Concepts (Basics)
Algorithm and Ambiguity
Problem Solving Designing Algorithms.
Computer Science Core Concepts
Unit 3 lesson 2-5 The Need For Algorithms- Creativity in Algorithms – Simple Commands - Functions Day 18.
Introduction to programming
ICT Gaming Lesson 2.
Tonga Institute of Higher Education IT 141: Information Systems
An Introduction to Programming with C++ Fifth Edition
Using Decision Structures
Unit 3: Lesson 1 - The Need for Programming Languages
Vocabulary Algorithm - A precise sequence of instructions for processes that can be executed by a computer Low level programming language: A programming.
This Lecture Substitution model
Tonga Institute of Higher Education IT 141: Information Systems
Basic Concepts of Algorithm
This Lecture Substitution model
Type Topic in here! Created by Educational Technology Network
U3L2 The Need For Algorithms
U3L4 Using Simple Commands
Presentation transcript:

Creativity in Algorithms UNIT 3 – CHAPTER 1 – LESSON 3 Creativity in Algorithms

Vocabulary Alert: Algorithm - A precise sequence of instructions for processes that can be executed by a computer Iterate - To repeat in order to achieve, or get closer to, a desired goal. Boolean – when you have two choices, on or off, yes or no Selection - A generic term for a type of programming statement (usually an if-statement) that uses a Boolean condition to determine, or select, whether or not to run a certain block of statements. Sequencing - Putting commands in correct order so computers can read the commands. Creativity - has to do with both the process you invent (an algorithm) to solve a new problem in clever ways that can be executed by a machine.

The purpose of this lesson is to see what "creativity in algorithms" means. 

 Creativity often means combining or using algorithms you know as part of a solution to a new problem.

Different algorithms can be developed to solve the same problem Different programs (or code) can be written to implement the same algorithm.

Let’s learn a little program sequence: What is the answer to this program? X = 2 X = 5 X = X + 1

Get into pairs Get your cards Activity guide - Human Machine Language - Part 2: Min To Front

Review the first page of the activity guide and the addition of the "swap" command.

Here's what the example program does: END STATE: the order of the cards has been reversed It does this by first moving the right hand to the end of the list, then shifting each hand progressively toward the middle of the row, swapping cards each time. The program stops once the hands have crossed over each other (by checking if RHPos < LHPos)

Challenge: Min-to-Front The challenge is to find the min card and swap it to the front of the list, keeping the order of the rest of the cards the same.

IDEA: Solve move-to-front first Remember: "Algorithms can be combined to make new algorithms“ You should know a solution to find min, so you can put that out of mind for a minute. So, start by assuming that you've found the min card, and writing a procedure to move some card to the front of the list, by swapping. Once you've got that you can tack the two together IDEA: Don't be afraid to invent a completely new algorithm get creative - you might need or want to invent a whole new algorithm

have groups trade algorithms to test out each others' solutions

The CSP Framework states: 4. 1 The CSP Framework states: 4.1.1A Sequencing, selection, and iteration are building blocks of algorithms. 4.1.2G Every algorithm can be constructed using only sequencing, selection, and iteration.

If these statements are true then we should be able to identify these elements of sequencing, selection and iteration in our Find-Min and Min-to-Front algorithms. I'll give you a quick definition of each and you tell me if or where we saw it in our Human Machine Language programs.

“4.1.1B Sequencing is the application of each step of an algorithm in the order in which the statements are given." -- Does our human machine language have sequencing? Sequencing is so fundamental to programming it sometimes goes without saying. In our lesson, the sequencing is simply implied by the fact that we number the instructions with the intent to execute them in order.

"4.1.1C Selection uses a [true-false] condition to determine which of two parts of an algorithm is used." -- Where did we see "selection" in our human machine language programs? The JUMP…IF command in the Human Machine Language is a form of selection. It gives us a way to compare two things (numbers) and take action if the comparison is true, or simply proceed with the sequence if false. NOTE: Selection is also known as “branching” most commonly seen in if-statements in programs.

"4.1.1D Iteration is the repetition of part of an algorithm until a condition is met or for a specified number of times." -- Where did we see iteration in our human machine language programs? The JUMP command (as well as JUMP...IF) in the Human Machine Language allows us to move to a different point in the program and start executing from there. This allows us to re-use lines of code, and this is a form of iteration or looping. NOTE: Iteration is also known as “looping” in most programming languages.

Important points: Algorithms can be combined to make new algorithms Low-Level languages exist - most basic, primitive, set of commands to control a computer. The Human Machine Language is similar to something called Assembly Language 

Assembly Language

From the CSP Framework: 2. 2 From the CSP Framework: 2.2.3C Code in a programming language is often translated into code in another (lower level) language to be executed on a computer.

The Human Machine Language is a "low level" language because the commands are very primitive and tie directly specific functions of the "human machine".

If you did not watch this video in Lesson 1, watch it here: Video: You Should Learn to Program: Christian Genco at TEDxSMU - Video

Learning to program is really learning how to think in terms of algorithms and processes. And it can be really fun and addicting. It also can make you feel like you have magical powers.

Fill in assessments and reflections in Code Studio. You have homework!