Creativity of Algorithms & Simple JavaScript Commands

Slides:



Advertisements
Similar presentations
1 CS101 Introduction to Computing Lecture 17 Algorithms II.
Advertisements

Creating Computer Programs lesson 27. This lesson includes the following sections: What is a Computer Program? How Programs Solve Problems Two Approaches:
8 Algorithms Foundations of Computer Science ã Cengage Learning.
CHAPTER 1 Overview of Programming and Problem Solving.
The Beauty and Joy of Computing Lecture #3 : Creativity & Abstraction UC Berkeley EECS Lecturer Gerald Friedland.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
Algorithms & FlowchartsLecture 10. Algorithm’s CONCEPT.
8.1 8 Algorithms Foundations of Computer Science  Cengage Learning.
Flow Control in Imperative Languages. Activity 1 What does the word: ‘Imperative’ mean? 5mins …having CONTROL and ORDER!
AP CSP: Pixelation – B&W/Color Images
Computers and Programming
AP CSP: Creating Functions & Top-Down Design
The Need for Algorithms
JavaScript/ App Lab Programming:
Algorithms and Problem Solving
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.
AP Computer Science Principles
Unit 3: Lesson 1 - The Need for Programming Languages
The Beauty and Joy of Computing Lecture #4 : Creativity & Abstraction
UNIT 2 – LESSON 3 Encoding B&W Images.
UNIT 1 – LESSON 5 BINARY NUMBERS.
Unit 3 lesson 2&3 The Need For Algorithms- Creativity in Algorithms
Creativity in Algorithms
Programming Mehdi Bukhari.
Lesson 5-15 AP Computer Science Principles
UNIT 3 – LESSON 5 Creating Functions.
Pseudocode Upsorn Praphamontripong CS 1110 Introduction to Programming
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
Functions CIS 40 – Introduction to Programming in Python
Vocabulary Algorithm - A precise sequence of instructions for processes that can be executed by a computer.
Introduction CSE 1310 – Introduction to Computers and Programming
Foundations of Programming: Introduction to Programming
Algorithm and Ambiguity
IPC144 Introduction to Programming Using C Week 2 – Lesson 1
Chapter 6 Repetition Objectives ❏ To understand basic loop concepts:
Creativity in Algorithms
Lesson 2 Programming constructs – Algorithms – Scratch – Variables Intro.
Lesson 16: Functions with Return Values
Lesson 15: Processing Arrays
UNIT 3 CHAPTER 1 LESSON 4 Using Simple Commands.
Winter 2018 CISC101 12/2/2018 CISC101 Reminders
Coding Concepts (Basics)
Algorithm and Ambiguity
Global Challenge Walking for Water Lesson 2.
Creating Computer Programs
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
Unit 3 lesson 2-5 The Need For Algorithms- Creativity in Algorithms – Simple Commands - Functions Day 18.
ECE 352 Digital System Fundamentals
An Introduction to Programming with C++ Fifth Edition
U3L1 The Need For Programming
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.
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.
Type Topic in here! Created by Educational Technology Network
Creating Computer Programs
U3L2 The Need For Algorithms
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
IPC144 Introduction to Programming Using C Week 2 – Lesson 2
U3L4 Using Simple Commands
Presentation transcript:

Creativity of Algorithms & Simple JavaScript Commands

Do Now: 1. ASCii is a character-encoding scheme that uses a numeric value to represent each character. For example the uppercase letter “G” is represented by the decimal (base-10) value 71. A partial list of characters and their corresponding ASCii values are shown in the table below. ASCii characters can also be represented by hexadecimal numbers. According to ASCii Character, which letter is represented by the hexadecimal (base-16) number 58?

Do Now Continued: 2. Which of the following are true statements about digital certificates in Web browsers?

Review: We don’t use human language to define commands for computers because human language is very ambiguous. We need a new type of language, a language that has clear and defined commands. We need a Programming Language. Programming languages have a defined a basic set of commands which gives a computer the clarity needed to perform some task (run a program). Using combinations of these basic commands allows us to create Algorithms (A precise sequence of instructions for processes that can be executed by a computer) which are used to solve various problems in life. Liking finding the smallest card in a set. Creating algorithms is the challenging part. It requires cleverness and an understanding of the commands available in a programming language.

Developing Algorithms: We study algorithms and care about them because in programming the techniques and mechanics of certain processes come up over and over and over again. So it’s worth knowing a few. For example, you just wrote an algorithm to find the smallest card in a row of cards. Is it hard to modify that exact same strategy to find the max card? Now you are going to build on an algorithm we just developed!

Min To Front Algorithm & More Do the example program and practice using the “swap” command. You will now develop an algorithm that finds the min card and swap it to the front of the list, keeping the order of the rest of the cards the same. You can add onto the algorithm you created to find the min card or you can develop a completely new algorithm. Solve move-to-front first; Act as if you already know the min card and just focus on moving a card to the front. Get Creative! If you are done developing the Min to Front Algorithm try creating an algorithm for one of the other problems in your packet Try to develop an algorithm to sort all your cards.

Solution: Trade Algorithms with a group near you so you can test out each others solutions. An example solution is to the right. This algorithm is a combination of the algorithms used to find the Min card in a set.

Sequencing, Selection, and Iteration: Sequencing is the application of each step of an algorithm in the order in which the statements are given. Sequencing is simply implied by numbering the order of instructions Selection (Branching) uses a [true-false] condition to determine which of two parts of an algorithm is used. The JUMP…IF command 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. Iteration (looping) is the repetition of part of an algorithm until a condition is met or for a specified number of times. The JUMP command (as well as JUMP…IF)  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.

Algorithms:  Sequencing, selection, and iteration are building blocks of algorithms. Every algorithm can be constructed using only sequencing, selection, and iteration. You can find evidence of these techniques in our Find-Min and Min-To-Front Algorithms Algorithms can be combined to make new algorithms  Find-Min problem and the Min-to-Front problem is an example of this. Most programming languages that you use in every day life are simply higher level, perhaps easier-to-read commands that are translated into more primitive machine commands. “Low level” languages (assembly) are the most basic, primitive, set of commands to control a computer. A high level language is more abstract, provides more functionality to make it faster to write and reason about programs, but ultimately that code is translated down into low-level, primitive machine instructions 

Building Blocks: Computers are machines. So if we invent an instruction or command for a computer to execute, then it should be unambiguous how the computer will interpret or attempt to execute that instruction. The challenge of programming at its core, is understanding how to use and combine those machine instructions to make the computer do what you want, or to solve a problem. All of the complexity we see on a computer is actually just the composition (the combining and recombining) of a few simple elements. In Unit 1 with the Internet, as we built up complex routing and naming protocols, all from understanding how to coordinate communication between two people on a shared wire. In Unit 2 we complex data types are all built up from simple binary codes. We will do the same thing with programming! To learn about programming we are going to solve problems with only a few primitive commands. 

Introduction to App Lab: App Lab is the programming environment we’re going to use for the rest of the course to write programs and apps. App Lab is embedded into Code Studio for many lessons and usually presents you with a series of problems to solve to learn the basic concepts. As you get better and better at coding, App Lab will show you more and more things you can do. But to start, we’re going to keep things simple and build up the complexity. Go to Unit 3 Stage 4 and work in App Lab (JavaScript) You are limited to four commands only for this exercise Work through the different tasks with a partner and check in with your partner at the conclusion of each problem to compare solutions.

Efficiency: What strategies or reasoning did you use to identify possible solutions? Is the solution that you or another group found the most efficient? How do you know? What does “efficiency” mean? “Efficiency” can mean different things depending on the context. When we try to create efficient programs, what other valuable resources might we be concerned about conserving?

4 Commands only?? App Lab has much more than four basic commands, so why did the widget limit your ability? Collaborative problem-solving skills are important factors in programming. Being able to get together with other people to talk about and make reasoned arguments about the best ways to code things is what professionals do. Creativity You need to understand how to use the features of a programming language to solve a problem. You will always be constrained by the programming language.  The reason you need to learn how to program is because there isn’t a command to do every little thing; you have to understand the set of things that a programming language can do, and then use your creativity and problem-solving skills to get the computer to do what you want.

Homework: You can continue playing with App Lab if you would like to at home. For homework you are going to watch a video on why you should learn to program. You are also going to respond to this video either positively or negatively with a minimum of a 100 words and a maximum of 150 words. Comment on what you liked or what it meant to you or maybe comment why you didn’t like the video. “You Should Learn to Program: Christian Genco” : https://www.youtube.com/watch?v=xfBWk4nw440