2.2 Algorithms 21-Jul-18.

Slides:



Advertisements
Similar presentations
Using Jeroo Dianne Meskauskas
Advertisements

13-Jun-14 OOP features of Jeroo. Overview In this presentation we will discuss these topics: OOP terminology Jeroo syntax constructors methods.
1 ICS102: Introduction To Computing King Fahd University of Petroleum & Minerals College of Computer Science & Engineering Information & Computer Science.
S.T.A.I.R.. General problem solving strategy that can be applied to a range problems.
Programming in Jessica By Joaquin Vila Prepared by Shirley White Illinois State University Applied Computer Science Department.
SIMPLE PROGRAMS Jeroo – Chapter 4 –. Basic Concepts Jeroo (Java/C++/object-oriented) programing style is case-sensative. Be consistent in coding Logic.
Jeroo Chapter 3 Problem Solving and Algorithms. Problem Solving and Algorithms  The story of Aunt Kay  A computer is a tool used to solve problems 
Algorithms and Problem Solving-1 Algorithms and Problem Solving.
Algorithms and Problem Solving. Learn about problem solving skills Explore the algorithmic approach for problem solving Learn about algorithm development.
Introduction Using the Pythagorean Theorem to solve problems provides a familiar example of a relationship between variables that involve radicals (or.
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!
Algebra Problems… Solutions
Lesson 4.1: Addition and Subtraction of 1 and 10
30-Aug-15 Using Jeroo. Overview In this presentation we will discuss: What is Jeroo? Where did it come from? Why use it? How it works. Your first assignments.
Tell the robot exactly how to draw a square on the board.
17-Sep-15 Using Jeroo. Overview In this presentation we will discuss: What is Jeroo? Where did it come from? Why use it? How it works. Your first assignments.
CS001 Introduction to Programming Day 5 Sujana Jyothi
5-Oct-15 Introduction and Code. Overview In this presentation we will discuss: What is Jeroo? Where can you get it? The story and syntax of Jeroo How.
Welcome to my conference! February th grade Guadalupe.
W RITING THE FIRST DRAFT OF YOUR COLLEGE ESSAY STEP 1: PLAN YOUR APPROACH BY THINKING ABOUT YOURSELF What are your strengths and weaknesses? What are your.
ECE 2300 Circuit Analysis Lecture Set #6 The Node Voltage Method with Voltage Sources.
25-Oct-15 Jeroo Code. Overview In this presentation we will discuss: How to write code in Jeroo How to run a Jeroo program.
2-1 Functions. What is a Function? Definition: __________________________ ___________________________________ The x values of a function are called the.
13-Nov-15 Control Structures. Overview Without control structures, everything happens in sequence, the same way every time Jeroo has two basic control.
Spreadsheet Engineering Builders use blueprints or plans – Without plans structures will fail to be effective Advanced planning in any sort of design can.
16-Dec-15 Control Structures VB. Overview Without control structures, everything happens in sequence, the same way every time Jeroo has two basic control.
Position and displacement. Objectives Describe motion in 1D using position, distance, and displacement. Analyze motion in 1D using position, distance,
M1G Introduction to Programming 2 3. Creating Classes: Room and Item.
1. 2 In what ways does your magazine use, develop or challenge forms and conventions of real music magazines? I tried to keep with convention when designing.
Chapter 7 What Can Computers Do For Me?. How important is the material in this chapter to understanding how a computer works? 4.
Relative Velocity Part 4  In this packet we look at how to determine the relative velocity of two objects when the objects are moving at angles to one.
Programming Introduction. What is a program? Computers cannot think for themselves, they can only follow instructions. A program is a set of instructions.
17-Feb-16 Methods. Overview In this presentation we will discuss these 4 topics: Main method vs. Jeroo methods Choosing behaviors to turn into methods.
11-Jun-16 Algorithms 2.2. Overview In this presentation we will discuss: What is an algorithm? 5 steps in developing an algorithm A Jeroo example.
Introduction to Problem Solving Programming is a problem solving activity. When you write a program, you are actually writing an instruction for the computer.
Introduction to Jeroo a small object oriented programming language.
Methods 9-Mar-17.
Introduction to CSCI 1311 Dr. Mark C. Lewis
Advanced Higher Computing Science
How To Share My Feelings
Algorithms and Problem Solving
AP CSP: The Need for Programming Languages and Algorithms
Pythagorean Theorem MACC.8.G Apply the Pythagorean Theorem to determine unknown side lengths in right triangles in real-world and mathematical problems.
Jeroo Code 18-Jul-18.
The Need for Algorithms 2 days
Programming – Touch Sensors
OOP features of Jeroo 8-Nov-18.
a small object oriented programming language.
Sparse and Redundant Representations and Their Applications in
Programming Fundamentals (750113) Ch1. Problem Solving
Pythagorean Theorem.
Applied Software Project Management
Introduction and Code 18-Jan-19.
Overview Introduction to Jeroo: What is Jeroo? Where did it come from?
CSE 2010: Algorithms and Data Structures Algorithms
Quadratic Equations.
Algorithms and Problem Solving
Flowcharts and Pseudo Code
Workshop for Programming And Systems Management Teachers
Computational Thinking
Control Structures 12-May-19.
2.2 Algorithms 26-Jun-19.
OOP features of Jeroo 3-Jul-19.
Indentation & Comments
Control Structures VB part 2
IF 1-Jul-19.
One-step addition & subtraction equations: fractions & decimals
Jeroo Code 7-Sep-19.
Presentation transcript:

2.2 Algorithms 21-Jul-18

Overview In this presentation we will discuss: What is an algorithm? 5 steps in developing an algorithm A Jeroo example

An algorithm is... A plan for solving a problem 5 steps in algorithm development Describe the problem clearly Analyze the problem Develop a high-level algorithm Refine the algorithm by adding detail Review the algorithm

Step 1: describe the problem Not as easy as it seems. Common defects: Description relies on unstated assumptions Description is ambiguous Description is incomplete Description has contradictions Natural spoken languages are not very precise. It’s the developer’s job to spot any of these problems BEFORE any problem solving happens.

Step 2 : Analyze the problem Similar to a mathematician determining what factors and given and what must be proven in a complex set of equations. Ask: What data is available? What formulas are needed? What rules apply? What relationships exist among the data values? What determines a complete solution? (When am I done?)

Step 3: Develop a high-level algorithm An overview. Not detailed. For example: Step 1 : the problem I need to send a birthday card to my brother, Mark. Step 2: Analyze I don’t have a card. I prefer to buy a card rather than make one myself. Step 3: High Level Algorithm Go to a store that sells cards Select and purchase a card Mail the card

High-level algorithms Go to a store that sells cards Select and purchase a card Mail the card Lacks enough detail for a computer or robot to understand Which store? How will you get to the store? (bike, car, bus?) What kind of card does Mark like? (funny, risqué, outdoorsy?)

Step 4: Refine the algorithm by adding detail Stepwise refinement= Keep adding levels of detail. To know what level of detail is needed You need to know how it will ultimately be implemented Birthday card example Who is going? Me? Very little detail needed Another family member? Minimal detail Someone unfamiliar with the area? Lots of detail about directions A robot? Minute detail.

Stepwise refinement The more complex the problem, the more steps it takes to refine it to sufficient detail. High Level   detailed level For very large problems you go through the process many times, developing intermediate level algorithms as you go.

Step 5: Review First: Work through the algorithm step by step and determine whether or not it actually solves the problem. Then ask: Does it solve a particular problem or a general one? Should it be generalized? A program to find the area of a circle with radius = 5.2 could easily be generalized to find the area of any circle with the addition of a single variable. Can it be simplified? Is this solution similar to something already done?

A Jeroo example Step 1: the problem clearly defined. A Jeroo starts at (0,0) facing East with no flowers in its pouch. There is a flower at location (0,3). The Jeroo should pick the flower and plant it at location (2,3) and then hop one square to the East. There are no other nets, flowers or Jeroos on the island.

Analysis of the problem (step 2) The flower is 3 spaces ahead of the Jeroo The flower should be planted 2 spaces south of its current location The Jeroo should end up at location (2,4) facing east There are no obstacles to worry about NORTH Jeroo flower Start positions

High-Level Algorithm (step 3) Start positions End positions Create a Jeroo named Bob Bob should: Get the flower Plant the flower Hop East

Detailed Algorithm (step 4) Create a Jeroo named Bob Bob should: Get the flower Hop 3 times Pick the flower Plant the flower Turn right Hop 2 times Plant a flower Hop East Turn left Hop once

Review (step 5) The high-level algorithm created 3 distinct, easy sub-problems. This seems like a good technique. This solves a very specific problem. It actually works for any setup where the Jeroo starts anywhere and the flower is 3 spaces directly ahead of it.

Good programming practices Detailed Algorithm: Create a Jeroo named Bob Bob should: Get the flower Hop 3 times Pick the flower Plant the flower Turn right Hop 2 times Plant a flower Hop East Turn left Hop once method main() { Jeroo bob = new Jeroo(); // ---- Get the flower --- // --- Plant the flower --- // --- Hop east --- } Comments clearly mirror the high-level algorithm

Then add detail Detailed Algorithm: Create a Jeroo named Bob method main() { Jeroo bob = new Jeroo(); // ---- Get the flower --- bob.hop(3); bob.pick(); // --- Plant the flower --- bob.turn(RIGHT); bob.hop(2); bob.plant(); // --- Hop east --- //Etc. } Detailed Algorithm: Create a Jeroo named Bob Bob should: Get the flower Hop 3 times Pick the flower Plant the flower Turn right Hop 2 times Plant a flower Hop East Turn left Hop once

The End