1. Introduction Intro Programming in C++ Computer Science Dept Va Tech August, 2002 ©1995-2002 Barnette ND & McQuain WD 1 Algorithm:a finite set of instructions.

Slides:



Advertisements
Similar presentations
Chapter 1 An Overview of Computers and Programming Languages.
Advertisements

Overview of Programming and Problem Solving ROBERT REAVES.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming The software development method algorithms.
McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter 14 Programming and Languages.
This set of slides is provided by the author of the textbook1 Introductory Topics l Computer Programming l Programming Life-Cycle Phases l Creating an.
Chapter 1 Introduction to Object- Oriented Programming and Problem Solving.
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
Computers: Tools for an Information Age
Chapter 1 Introduction to C Programming. 1.1 INTRODUCTION This book is about problem solving with the use of computers and the C programming language.
Programming Fundamentals (750113) Ch1. Problem Solving
Chapter 1 Program Design
Programming and Languages Chapter Competencies (Page 1 of 2) Describe the six steps of programming Discuss design tools including top-down design,
PRE-PROGRAMMING PHASE
Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 1 Introduction To Computers.
1 L07SoftwareDevelopmentMethod.pptCMSC 104, Version 8/06 Software Development Method Topics l Software Development Life Cycle Reading l Section 1.4 – 1.5.
Programming Languages – Coding schemes used to write both systems and application software A programming language is an abstraction mechanism. It enables.
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
Programming Languages CPS120: Introduction to Computer Science Lecture 5.
Chapter 1 An Overview of Computers and Programming Languages.
Introduction to Programming Lecture Number:. What is Programming Programming is to instruct the computer on what it has to do in a language that the computer.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
CSC141 Introduction to Computer Programming
Computer Programming Basics Assistant Professor Jeon, Seokhee Assistant Professor Department of Computer Engineering, Kyung Hee University, Korea.
TMF1013 : Introduction To Computing Lecture 1 : Fundamental of Computer ComputerFoudamentals.
16. Binary Numbers Programming in C++ Computer Science Dept Va Tech August, 1999 © Barnette ND, McQuain WD, Keenan MA 1 Binary Number System Base.
The Development Process Problem Solving. Problem Solving - Dr. Struble 2 What Is Asked of Computer Programmers? Input Transformation Output Write a computer.
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.
Fundamental Programming: Fundamental Programming K.Chinnasarn, Ph.D.
Problem Solving using the Science of Computing MSE 2400 EaLiCaRA Spring 2015 Dr. Tom Way.
IXA 1234 : C++ PROGRAMMING CHAPTER 1. PROGRAMMING LANGUAGE Programming language is a computer program that can solve certain problem / task Keyword: Computer.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
The Programming Process Define the problem* Make or buy software? Design the program * Code (write) the program Test (debug) the program Document the.
Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm.
Chapter 2: General Problem Solving Concepts
CHAPTER 1 INTRODUCTION 1 st semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
CS221 Algorithm Basics. What is an algorithm? An algorithm is a list of instructions that transform input information into a desired output. Each instruction.
Programming and Languages
2. Program Development Intro Programming in C++ Computer Science Dept Va Tech August 2001 ©2001 Barnette ND & McQuain WD 1 Top-Down Design:A solution method.
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
FOUNDATION IN INFORMATION TECHNOLOGY (CS-T-101) TOPIC : INFORMATION SYSTEM – SOFTWARE.
Introduction 1 (Read Chap. 1) What is Programming? For some given problem: design a solution for it -- identify, organize & store the problem's data --
Programming in C++ Dale/Weems/Headington Chapter 1 Overview of Programming and Problem Solving.
1 Chapter 1 Programming Languages Evolution of Programming Languages To run a Java program: Java instructions need to be translated into an intermediate.
Lecture (8) Programming Design Dr. Emad Elsharkawy Eng- Omar Salah Dr:Emad Elsharkawy 1 Saturday, 13 February 2016.
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.
Chapter 1 An Overview of Computers and Programming Languages.
Evolution of C and C++ n C was developed by Dennis Ritchie at Bell Labs (early 1970s) as a systems programming language n C later evolved into a general-purpose.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.
| MSC 8102:PROGRAMMING CONCEPTS By Vincent Omwenga, PhD. 1.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Software Engineering Algorithms, Compilers, & Lifecycle.
CS 1044 Introduction to Programming in C/C++. Hi, My Name is… David McPherson David McPherson 625 McBryde Hall 625 McBryde Hall
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
Introduction to Programming By: Prof. Muhammad Abu Baker Siddique 2 nd Lecture 1.
Algorithms and Flowcharts
INTRODUCTION TO COMPUTER PROGRAMMING ITC-314. Computer Programming  Computer Programming means creating a sequence of instructions to enable a computer.
Chapter 1 Introduction 2nd Semester H
Unit# 9: Computer Program Development
Introduction to Problem Solving
Lesson 2 Programming constructs – Algorithms – Scratch – Variables Intro.
Programming Fundamentals (750113) Ch1. Problem Solving
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Chapter 1 Introduction(1.1)
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Motivation Combinational logic functions can be represented, and defined, by truth tables. Sequential logic function cannot, because their behavior depends.
Basic Concepts of Algorithm
Presentation transcript:

1. Introduction Intro Programming in C++ Computer Science Dept Va Tech August, 2002 © Barnette ND & McQuain WD 1 Algorithm:a finite set of instructions that specify a sequence of operations to be carried out in order to solve a specific problem or class of problems. [Zwass] Algorithm Properties of algorithms: Finiteness: Algorithm must complete after a finite number of instructions have been executed. Absence of Ambiguity: Each step must be clearly defined, having only one interpretation. Definition of Sequence: Each step must have a unique defined preceding and succeeding step. The first step (start step) and last step (halt step) must be clearly noted. Feasibility: All instructions must be able to be performed. Illegal operations (division by 0) are not allowed. Input: 0 or more data values. Output: 1 or more results.

1. Introduction Intro Programming in C++ Computer Science Dept Va Tech August, 2002 © Barnette ND & McQuain WD 2 Algorithm:Newton-Raphson (3 iteration version) 1.Input: a real number X. 2.If (X < 0) Then Output: X " cannot be negative." STOP. Endif 3.Set a variable, S, to Set a counter variable, I, to 3. 5.While (I > 0) Do a.Calculate the value (S + X / S) / 2.0. b. Set S to the value calculated in step 5a. c.Subtract 1 from I. Endwhile 6.Output: "The square root of " X " is about " S 7.STOP. 3-Iteration Newton-Raphson Algorithm Does this possess the properties of an algorithm listed on the previous slide?

1. Introduction Intro Programming in C++ Computer Science Dept Va Tech August, 2002 © Barnette ND & McQuain WD 3 The Programming Process Development Process Problem-Solving Phase 1. Analysis & Specification 2. Design of a General Solution 3. Verification. Implementation Phase 1. Production of a Specific Solution 2. Test Maintenance Phase 1. Use (Install, Execute) 2. Maintain (Modify) Pólya's Four-Step Process These are not really just a simple sequence of actions. Discovered errors will force a re-examination of the algorithm, or perhaps the underlying analysis or even the problem specification. Maintenance often costs more than development and marketing together. Especially if the design is ill-considered or the testing is inadequate.

1. Introduction Intro Programming in C++ Computer Science Dept Va Tech August, 2002 © Barnette ND & McQuain WD 4 Pólya’s Four-Step Process 1. Understand the problem a. Know the boundaries of the problem b. Know the constraints on the solution c. Know what actions are allowed 2. Devise a plan a. Organize thoughts to develop a detailed algorithm b. Use tools such as: outlining, flowcharting, and pseudocode. 3. Implement the plan a. Carry out the steps in the algorithm b. Translate the problem into a language understandable by the device to be used. 4. Test the plan a. Did the solution yield appropriate results? b. Can the solution be improved? There is no recipe for solving general problems. However these ideas are often useful: George Pólya ( )

1. Introduction Intro Programming in C++ Computer Science Dept Va Tech August, 2002 © Barnette ND & McQuain WD 5 What are the data? What is the required result? What is the starting point (initial conditions)? Is it at all possible to get the result from the data? Useful approach: solve the problem by hand. What steps did you take?Can you write them down? Is the problem divided into major parts?Can they be identified? Have any problem assumptions been made?What are they? Is the solution general? Understand the Problem

1. Introduction Intro Programming in C++ Computer Science Dept Va Tech August, 2002 © Barnette ND & McQuain WD 6 Have you seen a similar problem before? Do you know of a related problem with a useful solution? Can you use part of the related problem? Can the solution of the related problem be modified and used? Look at the data... repetitions hint at loops in the solution. Identify the patterns in the data. If you can't solve the problem, can you solve part of the problem? Devise a Plan

1. Introduction Intro Programming in C++ Computer Science Dept Va Tech August, 2002 © Barnette ND & McQuain WD 7 Check each step of the plan. Have you considered all the special cases? Can you arrive at a reasonable result given... reasonable data? unreasonable data? Make certain your solution works for "boundary conditions". Empty data?Data set too large? Data sets that results in illegal operations (division by zero)? Implement the Plan

1. Introduction Intro Programming in C++ Computer Science Dept Va Tech August, 2002 © Barnette ND & McQuain WD 8 Did you compute any intermediate results that were not used later? Can they be eliminated? Can the result be derived differently? Can the solution be made simpler or more general? Can the solution method be used for other problems? Test the Plan

1. Introduction Intro Programming in C++ Computer Science Dept Va Tech August, 2002 © Barnette ND & McQuain WD 9 Machine Language: (very low-level language) -consists of strings of 0's and 1's (binary digits or bits); often expressed in base 16 (hexadecimal) for clarity -different for each machine (machine dependent) -all programs must be written in machine language (code) OR be translated into machine code before being executed Assembly Language: (low or intermediate level) -short abbreviations (mnemonics) are used for instructions; for the assembly code above, one might have: Language Levels... 8b ff c ff ff... mov edx, DWORD PTR _SumOfScores$[ebp] add edx, DWORD PTR _nextScore$[ebp] mov DWORD PTR _SumOfScores$[ebp], edx...

1. Introduction Intro Programming in C++ Computer Science Dept Va Tech August, 2002 © Barnette ND & McQuain WD 10 Language Levels SumOfScores = SumOfScores + nextScore; High Level Languages: -Logical and relatively English-like -machine independent -must be translated before execution (compiled or interpreted) Some common high-level languages: COBOLCommon Business-Oriented Language FortranFormula Translation Pascaldesigned for programming instruction Adaintended for general DOD contractor use Cintended for system software development C++object-oriented extension of C language Javapure object-oriented design, portable but interpreted

1. Introduction Intro Programming in C++ Computer Science Dept Va Tech August, 2002 © Barnette ND & McQuain WD 11 source codehigh-level language instructions (C++) written by the programmer object codelow-level machine instructions readable by the hardware object code compiler interpreter Compilation Input Data results Execution loading object code linker executable Linking executable source code Building Program Translation