CSCI-100 Introduction to Computing

Slides:



Advertisements
Similar presentations
CS107 Introduction to Computer Science Lecture 3, 4 An Introduction to Algorithms: Loops.
Advertisements

CS107: Introduction to Computer Science Lecture 2 Jan 29th.
The LC-3 – Chapter 6 COMP 2620 Dr. James Money COMP
ISP 121 Algorithmsand Computer Programming. Why Know Simple Programming?  You can create powerful macros in Access / Excel / Word / ??? to manipulate.
Understanding the Three Basic Structures
Chapter 3 IFTHENELSE Control Structure © 2008 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. Marilyn Bohl/Maria Rynn Tools for Structured.
Computer Science 101 Overview of Algorithms. Example: Make Pancakes Prepare batter Beat 2 eggs Add 1 tablespoon of brown sugar Add 1 cup of milk Add 2.
Designing Algorithms Csci 107 Lecture 4. Outline Last time Computing 1+2+…+n Adding 2 n-digit numbers Today: More algorithms Sequential search Variations.
CMPUT101 Introduction to Computing(c) Yngvi Bjornsson & Jia You1 Algorithm Discovery and Design Chapter 2 Topics: Representing Algorithms Algorithmic Problem.
What is an algorithm? Informally: An Algorithm is a step by step method for solving a problem. It’s purpose is to break a larger task down so that each.
Chapter 2: Algorithm Discovery and Design
1 9/28/07CS150 Introduction to Computer Science 1 Loops section 5.2, 5.4, 5.7.
Chapter 2: Algorithm Discovery and Design
Designing Algorithms February 2nd. Administrativia Lab assignments will be due every Monday Lab access –Searles 128: daily until 4pm unless class in progress.
CS107 Introduction to Computer Science Lecture 2.
Designing Algorithms Csci 107 Lecture 3. Designing algorithms Last time –Pseudocode –Algorithm: computing the sum 1+2+…+n –Gauss formula for 1+2+…+n Today.
Chapter 2 The Algorithmic Foundations of Computer Science
Algorithm Design CS105. Problem Solving Algorithm: set of unambiguous instructions to solve a problem – Breaking down a problem into a set of sub- problems.
Chapter 2: Design of Algorithms
Algorithms and Efficiency of Algorithms February 4th.
Designing Algorithms Csci 107 Lecture 4.
Chapter 2: Algorithm Discovery and Design
Chapter 2: Algorithm Discovery and Design
Adapted from slides by Marie desJardins
CSCI-100 Introduction to Computing Algorithms Part I.
An ordered sequence of unambiguous and well-defined instructions that performs some task and halts in finite time Let's examine the four parts of this.
CPSC 171 Introduction to Computer Science 3 Levels of Understanding Algorithms More Algorithm Discovery and Design.
Algorithmic Problem Solving CMSC 201 Adapted from slides by Marie desJardins (Spring 2015 Prof Chang version)
THE BIG PICTURE. How does JavaScript interact with the browser?
General Programming Introduction to Computing Science and Programming I.
计算机科学概述 Introduction to Computer Science 陆嘉恒 中国人民大学 信息学院
Chapter 2: Algorithm Discovery and Design Invitation to Computer Science, C++ Version, Third Edition.
Invitation to Computer Science, Java Version, Second Edition.
1 Introduction to Flowcharting. 2 Writing a program Defining the problem –Write down what the program will do Planning –Write down the steps, draw a flowchart.
CSE 102 Introduction to Computer Engineering What is an Algorithm?
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
Introduction to Algorithms. What is Computer Science? Computer Science is the study of computers (??) This leaves aside the theoretical work in CS, which.
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
CPSC 171 Introduction to Computer Science Algorithm Discovery and Design.
PROBLEM SOLVING & ALGORITHMS CHAPTER 5: CONTROL STRUCTURES - SELECTION.
Flowcharts and Algorithms. Review of Terms  A computer is a machine that can represent and manipulate data –Ultimately the data and the instructions.
Chapter 2: General Problem Solving Concepts
COMPUTERS AND ALGORITHMIC PROCESSES LSP 121. What Is An Algorithmic Process? An ordered series of steps that when applied to a problem produces a solution.
Intro to Nested Looping Intro to Computer Science CS1510 Dr. Sarah Diesburg.
1 Chapter 9. To familiarize you with  Simple PERFORM  How PERFORM statements are used for iteration  Options available with PERFORM 2.
Programming Logic and Design, Introductory, Fourth Edition1 Understanding the Three Basic Structures Structure: a basic unit of programming logic Any program.
Chapter 7 Problem Solving with Loops
Algorithm Discovery and Design Objectives: Interpret pseudocode Write pseudocode, using the three types of operations: * sequential (steps in order written)
Topic: Control Statements. Recap of Sequence Control Structure Write a program that accepts the basic salary and allowance amount for an employee and.
Intro to Loops 1.General Knowledge 2.Two Types of Loops 3.The WHILE loop 1.
Lecture 7: Menus and getting input. switch Multiple-selection Statement switch Useful when a variable or expression is tested for all the values it can.
INVITATION TO Computer Science 1 11 Chapter 2 The Algorithmic Foundations of Computer Science.
Algorithms JPC and JWD © 2002 McGraw-Hill, Inc. 2 Algorithms 2 An Algorithm is a finite set of precise instructions for performing a computation or for.
Pseudocode Skill Area Materials Prepared by Dhimas Ruswanto, BMm.
Flow Control in Imperative Languages. Activity 1 What does the word: ‘Imperative’ mean? 5mins …having CONTROL and ORDER!
Chapter 2: Algorithm Discovery and Design Invitation to Computer Science.
Low-Level Programming Languages, Pseudocode and Testing Chapter 6.
Program Design & Development EE 201 C7-1 Spring
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 3 - Structured Program Development Outline.
Chapter 5: Control Structure
Introduction to pseudocode
Algorithm Discovery and Design
Iteration: Beyond the Basic PERFORM
Iteration: Beyond the Basic PERFORM
Algorithm Discovery and Design
Computer Science Core Concepts
Programming Concepts and Database
Print the following triangle, using nested loops
How to allow the program to know when to stop a loop.
Presentation transcript:

CSCI-100 Introduction to Computing Algorithms Part IV

Categories of operations Sequential operations Carry out a single well-defined task; when that task is finished, the algorithm moves on to the next operation Add 1 cup of butter to the mixture in the bowl Subtract the amount of the check from the current account balance Conditional operations Ask a question and then select the next operation to be executed on the basis of the answer to that question If the mixture is too dry, then add one-half cup of water to the bowl Iterative operations Tell us to go back and repeat the execution of a previous block of instructions Repeat previous operations until mixture has thickened

Sequential Operations

Sequential Operations Examples (DONE IN CLASS) Write pseudocode for an algorithm that gets three data values x, y, and z as input and outputs the average of those three values Write pseudocode for an algorithm that gets the radius r of a circle as input. Its output is both the circumference and the area of a circle of radius r

Conditional and Iterative Operations

Conditional and Iterative Operations

Conditional and Iterative Operations Examples (DONE IN CLASS) Write an if/then/else statement that sets the variable y to the value 1 if x ≥0. If x < 0 then the statement should set y to the value 2 Write an algorithm that gets as input three data values x, y, and z and outputs the average of these values if the value of x is positive. If the value of x is either zero or negative, your algorithm should not compute the average but should print the error message “Bad Data” instead

Example (DONE IN CLASS) Implement an algorithm to multiply two numbers, a and b, using repeated addition Algorithm outline Create a loop that executes exactly b times, with each execution of the loop adding the value of a to a running total (DONE IN CLASS)