Algorithms and Pseudocode. What is an algorithm? An algorithm is a description of a process independent of any programming language. e.g. An algorithm.

Slides:



Advertisements
Similar presentations
PROBLEM SOLVING TECHNIQUES
Advertisements

CHAPTER 2 GC101 Program’s algorithm 1. COMMUNICATING WITH A COMPUTER  Programming languages bridge the gap between human thought processes and computer.
Session Objectives# 24 COULD code the solution for an algorithm
Detailed Design Kenneth M. Anderson Lecture 21
Algorithms and Problem Solving-1 Algorithms and Problem Solving.
CEG 221 Lesson 5: Algorithm Development II Mr. David Lippa.
Algorithms and Problem Solving. Learn about problem solving skills Explore the algorithmic approach for problem solving Learn about algorithm development.
Chapter 2: Design of Algorithms
Chapter 8: Introduction to High-level Language Programming Invitation to Computer Science, C++ Version, Third Edition.
Chapter 3 Planning Your Solution
Review Algorithm Analysis Problem Solving Space Complexity
PRE-PROGRAMMING PHASE
The Art of Programming Top-Down Design. The Art of Problem Solving The art of problem solving is the transformation of an English description of a problem.
1 L07SoftwareDevelopmentMethod.pptCMSC 104, Version 8/06 Software Development Method Topics l Software Development Life Cycle Reading l Section 1.4 – 1.5.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
PROGRAMMING, ALGORITHMS AND FLOWCHARTS
CPSC 171 Introduction to Computer Science 3 Levels of Understanding Algorithms More Algorithm Discovery and Design.
Data Structures & AlgorithmsIT 0501 Algorithm Analysis I.
Chapter 3 Developing an algorithm. Objectives To introduce methods of analysing a problem and developing a solution To develop simple algorithms using.
Chapter 1 Introduction to Computers and C++ Programming Goals: To introduce the fundamental hardware and software components of a computer system To introduce.
School of Computer Science & Information Technology G6DICP - Lecture 9 Software Development Techniques.
Developing an Algorithm
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
IXA 1234 : C++ PROGRAMMING CHAPTER 1. PROGRAMMING LANGUAGE Programming language is a computer program that can solve certain problem / task Keyword: Computer.
Even more problems.. Mean (average) I need a program that calculates the average of student test scores. I need a program that calculates the average.
Chapter Algorithms 3.2 The Growth of Functions 3.3 Complexity of Algorithms 3.4 The Integers and Division 3.5 Primes and Greatest Common Divisors.
Developing an Algorithm. Simple Program Design, Fourth Edition Chapter 3 2 Objectives In this chapter you will be able to: Introduce methods of analyzing.
The Software Development Process
ALGORITHMS.
Introduction to C Programming CE Lecture 5 Program Design in C.
Algorithm Discovery and Design Objectives: Interpret pseudocode Write pseudocode, using the three types of operations: * sequential (steps in order written)
8.1 8 Algorithms Foundations of Computer Science  Cengage Learning.
LESSON 1 Introduction to Programming Language. Computer  Comprised of various devices that are referred to as HARDWARE.  The computer programs that.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Flowchart. a diagram of the sequence of movements or actions of people or things involved in a complex system or activity. a graphical representation.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 4: Introduction to C: Control Flow.
Algorithms and Pseudocode
ALGORITHMS AND FLOWCHARTS. Why Algorithm is needed? 2 Computer Program ? Set of instructions to perform some specific task Is Program itself a Software.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
Program Program is a collection of instructions that will perform some task.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
| MSC 8102:PROGRAMMING CONCEPTS By Vincent Omwenga, PhD. 1.
Chapter 1 Lesson 7 Variance and Standard Deviation.
Programming revision Revision tip: Focus on the things you find difficult first.
Dept of Computer Science University of Maryland College Park
Program design Program Design Process has 2 phases:
ALGORITHMS AND FLOWCHARTS
3.1 Fundamentals of algorithms
Algorithms, Part 1 of 3 The First step in the programming process
Unit 3: ALGORITHMS AND FLOWCHARTS
Do it now activity Last lesson we used Flowol to create a solution to a problem a computer could solve. Identify what each symbol does:
ALGORITHMS AND FLOWCHARTS
COVERED BASICS ABOUT ALGORITHMS AND FLOWCHARTS
CS111 Computer Programming
Algorithms and Flowcharts
Algorithm Algorithm is a step-by-step procedure or formula or set of instruction for solving a problem Its written in English language or natural language.
Introduction to Computer Programming
Algorithm and Ambiguity
Understand the Programming Process
Design and Technology Academic Year 2017/2018 Grade 7 First Semester.
Unit# 9: Computer Program Development
Problem Solving Techniques
Algorithms Chapter 3 With Question/Answer Animations
Algorithms & Pseudocode
Algorithm Discovery and Design
Understand the Programming Process
Input, Process, Output Washing dirty clothes Process Output Input.
Flowcharts and Pseudo Code
COMPUTATIONAL THINKING COMPUTATIONAL THINKING IN PROGRAMMING
Can you think of 2 purposes of the operating system?
Presentation transcript:

Algorithms and Pseudocode

What is an algorithm? An algorithm is a description of a process independent of any programming language. e.g. An algorithm to find side a of right angled triangle given sides b and c Input b, c Calculate Square root of b squared plus c squared Output result

What is Pseudocode? Pseudo code is an informal, high-level description of an algorithm. This resembles a programming language but it uses less strict syntax and is independent of any real programming language. e.g. An algorithm to find side a of right angled triangle given sides b and c Input b, c a ← Sqrt(b*b + c*c) Output a

Task 1 - Structured English Algorithm Using the cards provided construct the algorithm to find the largest of the three numbers A, B and C.

Solution Logic Firstly, Number A is compared with Number B. If Number A is the largest, then LargestNumber takes on the value of Number A. If Number B is the largest, then LargestNumber Takes on the value of Number B. Then LargestNumber is compared to Number C. If Number C is larger then LargestNumber becomes Number C. Otherwise LargestNumber stays as it is.

Solution IF Number A > Number B THEN SET LargestNumber TO Number A ELSE SET LargestNumber TO Number B IF Number C > Largest Number THEN SET Largest Number TO Number C OUTPUT LargestNumber

StructureStructured English example Pseudocode example AssignmentMULTIPLY Number1 BY Number2 TO GET Product Product ← Number1 * Number2 SelectionIF score > 70 THEN SET Grade TO Merit If score > 70 Then grade  merit” End If IterationREPEAT UNTIL X = 10 Input Number Add Number to X Repeat Input Number X  X + Number Until X = 10 Structured English v Pseudocode

Task 2 – Garden Fence Algorithm Download and complete the Garden Fence algorithm worksheet on the A2 Computing homepage. Complete by next lesson…

Garden Fence Algorithm Solution Input gardenLength Input gardenWidth Input fenceWidth areaToFence  (gardenLength * 2) + gardenWidth numFencePanels  (areaToFence div fenceW) + 1 Output numFencePanels

Input paintArea PaintAreaNeeded  numFencePanels * fenceH * 2 NumTinsNeeded  (paintAreaNeeded div paintArea) + 1 Output numTinsNeeded Garden Fence Algorithm Extension

Resources Chapter 1.4 Algorithm Design – AS Computing by Bond and Langfield See pages 23, 24 and 25 in book

Principal Moderator’s Report Very few candidates gave clear algorithms relating to the data transformation to be programmed by the candidate. These algorithms should be in a form that could be coded in any language and need to concentrate on the complex parts of the system that the candidate is going to code. Frequently, the ‘sample’ was of very basic functions. We are not very interested in the algorithms required for login, form navigation and password changes etc. Algorithms in pseudocode or structured English must be given if a high mark is to be scored. Frequently ‘algorithms’ were post implementation code extracted from the full code listing, not in pseudocode or structured English as required. The algorithms presented in this section are one of the places that Moderators inspect closely at an early stage to confirm the potential level of complexity of the project. It is not appropriate to omit design algorithms and forward reference those given in the System Maintenance section because the purpose of the Design section is to allow a competent third party to implement the required system. Candidates were penalised heavily for doing this because the design is simply not feasible without design algorithms.

Exemplar Algorithms Project 4 pages 23 to 26 Project 7 pages 32 to 37 Project 9 pages 47 to 52