00 - Introduction To Problem Solving And Algorithms

  • July 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View 00 - Introduction To Problem Solving And Algorithms as PDF for free.

More details

  • Words: 716
  • Pages: 3
How People Solve Problems • A Problem exists when what we have (Data) is not the same as what we want (information) • People create a solution (called an Algorithm) which manipulates Data into Information • People do this quickly and often in a complex way

How Computers Solve Problems • Computers also use Algorithms to solve problems, and change data into information • Computers can only perform one simple step at a time • Complex “Human” Algorithms must be broken down into simple step-by-step instructions BEFORE they can be translated into computer code

Problem Solving • Problem Solving is the ability to understand what you have, what you want, and creating a set of instructions to change what you have into what you want • Good Problem Solving Skills are based on knowledge, experience and logic • Good Programmers NEVER make assumptions

Introduction to Problem Solving and Algorithms

Introduction to Problem Solving and Algorithms

Introduction to Problem Solving and Algorithms

Problem Solving Steps

Flowcharts and Pseudo Code

Flowcharts

Identify the Problem Understand and Analyze the Problem Identify Alternatives to Solve the Problem Choose the Best Alternative to Solve the Problem 5. Implement the Chosen Alternative 6. Evaluate the Solution

• A “Standard” way of describing an algorithm must exist if we expect our solution to be understood by others easily • There are two standards in programming:

1. 2. 3. 4.

Introduction to Problem Solving and Algorithms

Introduction to Problem Solving and Algorithms

– FLOWCHARTS – PSEUDOCODE

Introduction to Problem Solving and Algorithms

• A Flowchart is a Visual Representation of an algorithm • A Flowchart uses easy-to-understand symbols to represent actions on data and the flow of data • Flowcharts aid in breaking down a problem into simple steps

Introduction to Problem Solving and Algorithms

Pseudo Code • “Pseudo” means “pretend” or “false” • Pseudo Code is pretend or false computer code; generic English-like terms that are somewhat like computer code • Pseudo Code is not as standardized as flowcharts, and does not facilitate the breaking down of problems as well as a flowchart does

The Three Computer Programming Constructs • Any problem, regardless of how complex, can be broken down into three basic CONSTRUCTS – SEQUENCE – SELECTION – ITERATION

Sequence • Sequence is the most basic of the constructs • It is simply performing one step after another • Each step is followed in a specific sequence, hence the name • Sequence can be thought of as “do this, then do this, then do this”

Introduction to Problem Solving and Algorithms

Introduction to Problem Solving and Algorithms

Introduction to Problem Solving and Algorithms

Selection

Iteration

Visualizing The Constructs

• Selection is the decision-making construct • It is used to make yes/no or true/false decisions logically • Selection can be thought of as “if something is true take this action, otherwise take that action”

• Iteration comes from the word “reiterate”, which means to repeat • Iteration is a looping construct • Iteration is a combination of decision and sequence and can repeat steps • Iteration can be thought of as “while something is true, do this, otherwise stop”

Introduction to Problem Solving and Algorithms

Introduction to Problem Solving and Algorithms

Introduction to Problem Solving and Algorithms

• By using Flowchart symbols, we can visualize the three basic computer constructs • Every algorithm ever created is made up of only these three constructs

Introduction to Problem Solving and Algorithms

Basic Flowchart Symbols

Terminator

Process

Input/Output

Decision Connector

The Basic Flowchart Symbols

The Basic Flowchart Symbols

• The terminator shows where a specific piece of an algorithm beings and ends • A process is a basic action or actions on data • A decision is a logical test with two possible data paths resulting from one

• Input/Output gets data or displays information to the user of the algorithm • A connector connects two or more data flows into one • A data flow shows the direction of data’s movement through the algorithm

Data Flow

Introduction to Problem Solving and Algorithms

Introduction to Problem Solving and Algorithms

Introduction to Problem Solving and Algorithms

Sequence

Selection

Iteration

F

T F

Introduction to Problem Solving and Algorithms

Introduction to Problem Solving and Algorithms

Introduction to Problem Solving and Algorithms

T

Introduction to Problem Solving and Algorithms

Related Documents