## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

Computing: Languages and Algorithms

Administrivia Last time Exam #1 Scores are posted Exams will be returned/discussed on Thursday Today What is computation? How do we talk to computers? HW #6 Assigned .

Flow of Computation (abstract) Data Program Results (computer) .

How do we tell a computer what to do? Write a Program A program is a machine-understandable implementation of an Algorithm An algorithm is a sequence of instructions used to accomplish a goal Algorithm ~= Solution Write an algorithm for walking from this classroom to the Davies Center .

How do we tell a computer what to do? Write an Algorithm to move the red dot to the green check You can’t move through the yellow walls! Only allowed the following commands: Move X (move forward X spaces) Turn Right (90 degrees) Turn Left (90 degrees) .

How do we tell a computer what to do? Program: machine-understandable pattern of instructions for a computer to perform Need a language to describe (specify) this instruction pattern An intermediary between humans and the computer Language should be: Convenient for humans to express algorithms Convenient for computers to “understand” Why not “Natural Languages” ? (like English) .

Machine Language 0001110010000110 1101110110000010 0101001100110111 Sequence of instructions in binary code Code corresponds directly to instruction set of computer Direct control of machine Difficult to program. read. debug Not portable to other platforms .

0(r10) LW r6. 4(r10) ADD r7. sum These instructions typically correspond 1-to-1 with machine language instructions Mnemonic codes Symbolic names (like sum) Direct control over the hardware Still hard to use and not portable . r6 SW r7. r5.Assembly Language LW r5.

Matlab. Fortran. … Closer to natural language Easier to read. Mathematica. Examples: C++. Maple. debug & modify Employ powerful data and control primitives. Java.High-Level Languages sum = 5 + 6. write. which allow relatively concise specification of complex computation patterns Requires no knowledge of computer hardware Portability! . Python.

or both Equation – statement that two expressions are equal Typical Application: Story Problems . variables.Introduction to Algorithms Do algorithms relate to algebra? Both are derived from mathematician “Mohammed ibn-Musa al-Khwarizmi” Both deal with abstraction and manipulation Recall your basic algebra Variables – a symbol that represents a number Expression – a mathematical statement that may use numbers.

y = 10 Algorithms use proven mutations to transform one set of “state” into another set of “state” “State” collection of variables with a value The value of a variable can change over time! x := 3 x := x + 1 .Introduction to Algorithms Algebra uses proven equations to transform one set of true statements into another set of true statements x=3 y = 2x + 4 Therefore.

Introduction to Algorithms Algebra has many truth-preserving manipulations Algorithms have only a handful of state-mutating manipulations Core Manipulations Assignment to variables Sequence Selection Iteration .

Assignment to Variables Always need a variable on the left-hand side Three variants for right-hand side: A constant value Example: Example: Example: Balance ← 500 Balance ← SomeOtherBalance Balance ← Balance + Interest Another variable An expression using variables and constant values .

Place the pizza on a pizza pan and place on the center rack in your oven.Sequence Most primitive form of controlling action – one after the other Example: Baking a Take-Home Pizza Preheat conventional oven to 475 degrees. Remove the plastic wrap and cardboard circle Save the cardboard circle to cut and serve your pizza on. Remove pizza from oven. Bake for 20 – 30 minutes. Place pizza onto saved cardboard circle Cut into desired slices Serve and enjoy Does order matter? .

if the pizza is frozen then Bake for 20 – 30 minutes else bake for 15 – 20 minutes Remove pizza from oven. Remove the plastic wrap and cardboard circle Save the cardboard circle to cut and serve your pizza on. Place pizza onto saved cardboard circle Cut into desired slices Serve and enjoy .Selection Select between options based on some condition Example: Baking a Take-Home Pizza (frozen or thawed) Preheat conventional oven to 475 degrees. Place the pizza on a pizza pan and place on the center rack in your oven.

Place pizza onto saved cardboard circle Cut into desired number of slices Serve and enjoy . Place the pizza on a pizza pan Place pan on the center rack in your oven.Iteration Repeat steps based on some condition Example: Baking multiple Take-Home Pizzas (frozen or thawed) Preheat conventional oven to 475 degrees. If the pizza is frozen then bake for 20 – 30 minutes else bake for 15 – 25 minutes Remove pizza from oven. while there are more pizzas to bake do Select pizza to bake Remove the plastic wrap and cardboard circle Save the cardboard circle to cut and serve your pizza on.

HOMEWORK! Homework 6 Maple Tutorial 1 Complete the worksheet’s questions and turn it in Due 10/25/2010 Thursday’s Class in P115 .

- MCS-8 Assembly Language Programming Manual Preliminary Edition Nov73
- ch1
- Problems and Algorithms RAID
- Subject Knowledge Requirements for Entry Into Cs Teacher Training
- Comparison of Two Adaptive Identification Hemods for Iio)(Itoriffi and Diagnosis of An
- Lecture_01-Introduction to Programming
- 20070905-ch1-intro
- Decoupling B-Trees from Fiber-Optic Cables in B-Trees
- Catshit
- KS1 Crazy Character Algorithms Activity Barefoot Computing
- Scimakelatex.11202.None
- Рекомендательное письмо на английском образец
- Guidelines Test of Computer MSC 891
- Associate Expertise Exploitation Results Reality Fashion
- Contrasting Moore’s Law and Telephony.pdf
- Intro to Computer Ch5
- Dalgo algorithm
- Microprocessor1.pptx
- Week1_Intro to Computer
- Parallel Hilditch algo
- Mid Term
- John Pelo Blanco
- Mst 3
- Programming
- The Influence of Cacheable Symmetries on Certifiable Artificial Intelligence
- A Methodology for the Study of IPv4
- 0380001
- Sequences containing no 3-term arithmetic progressions
- A Methodology for the Synthesis of Redundandcy
- AMD 2900 Processor Simulator

- Robot Programming
- Simple Cooperative Scheduler for Arduino
- Controller Selection
- Dynamic Bayesian Networks_Thesis_Murphy.pdf
- Intro to Inference
- Exp3 Stepper Motor Control
- Controller Selection.pdf
- exp3 DC MOTOR SPEED CONTROL USING PWM.pdf
- Exp2.Stepper Motor
- Guide to Python's Magic Methods.pdf
- Lecture_13 Output Feedback Stabilization
- Exp1 Switching Principle
- Digital Sensors
- Tutorial on Monte Carlo Sampling.pdf
- Lecture_14 Tracking & Regulation
- Lab 2d - Sine_Wave_Generator.pdf
- Lecture_02 Stability of Equilibrium Points
- Lecture_01 Introduction & Two-Dimensional Systems
- DC Motor
- Advanced Robotics
- Lect_5 Stability of Equilibrium Points
- Advanced Robotics Abbeel
- Actuator Selection
- Analog Sensors.pdf
- NXP LPC1768 & Keil quadcopter project Lab Manual.pdf
- Microcomputer Implementation of Digital Control
- Lect_3 Two-Dimensional Systems
- Linear Actuators
- Lect_4 Stability of Equilibrium Points
- Lect 1 Intro

Sign up to vote on this title

UsefulNot usefulClose Dialog## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

Loading