Sei sulla pagina 1di 25

Problem Solving

Algorithms
Flowchart

Lecture 1 Designing Algorithms

Marbert John C. Marasigan


CS 110 (Foundations of Biocomputing)

August 12, 2016

Marbert John C. Marasigan CS 110 (Foundations of Biocomputing) Lecture 1 Designing Algorithms


Problem Solving
Algorithms
Flowchart

Outline

1 Problem Solving

2 Algorithms

3 Flowchart

Marbert John C. Marasigan CS 110 (Foundations of Biocomputing) Lecture 1 Designing Algorithms


Problem Solving
Algorithms
Flowchart

Problem Solving

Given a problem, we want to find a solution and implement the


solution. Of course, these steps are not only applicable to
computer science, but also to our daily lives. In computer
science, we call a problem, task, a solution, algorithm, and
we implement the solution using a programming language. The
major steps in solving problems are as follows:

Marbert John C. Marasigan CS 110 (Foundations of Biocomputing) Lecture 1 Designing Algorithms


Problem Solving
Algorithms
Flowchart

Problem Solving

Given a problem, we want to find a solution and implement the


solution. Of course, these steps are not only applicable to
computer science, but also to our daily lives. In computer
science, we call a problem, task, a solution, algorithm, and
we implement the solution using a programming language. The
major steps in solving problems are as follows:
1 Determine the requirements the program must meet.

Marbert John C. Marasigan CS 110 (Foundations of Biocomputing) Lecture 1 Designing Algorithms


Problem Solving
Algorithms
Flowchart

Problem Solving

Given a problem, we want to find a solution and implement the


solution. Of course, these steps are not only applicable to
computer science, but also to our daily lives. In computer
science, we call a problem, task, a solution, algorithm, and
we implement the solution using a programming language. The
major steps in solving problems are as follows:
1 Determine the requirements the program must meet.
2 Design an algorithm and verify that it satisfies the
requirements.

Marbert John C. Marasigan CS 110 (Foundations of Biocomputing) Lecture 1 Designing Algorithms


Problem Solving
Algorithms
Flowchart

Problem Solving

Given a problem, we want to find a solution and implement the


solution. Of course, these steps are not only applicable to
computer science, but also to our daily lives. In computer
science, we call a problem, task, a solution, algorithm, and
we implement the solution using a programming language. The
major steps in solving problems are as follows:
1 Determine the requirements the program must meet.
2 Design an algorithm and verify that it satisfies the
requirements.
3 Code a program from the algorithm, and verify it.

Marbert John C. Marasigan CS 110 (Foundations of Biocomputing) Lecture 1 Designing Algorithms


Problem Solving
Algorithms
Flowchart

Problem Solving

Given a problem, we want to find a solution and implement the


solution. Of course, these steps are not only applicable to
computer science, but also to our daily lives. In computer
science, we call a problem, task, a solution, algorithm, and
we implement the solution using a programming language. The
major steps in solving problems are as follows:
1 Determine the requirements the program must meet.
2 Design an algorithm and verify that it satisfies the
requirements.
3 Code a program from the algorithm, and verify it.
4 Test and debug the program.

Marbert John C. Marasigan CS 110 (Foundations of Biocomputing) Lecture 1 Designing Algorithms


Problem Solving
Algorithms
Flowchart

Concepts

Definition
An algorithm is a finite set of instructions to specify a
sequence of operations to be carried out in order to solve a
specific problem.

Marbert John C. Marasigan CS 110 (Foundations of Biocomputing) Lecture 1 Designing Algorithms


Problem Solving
Algorithms
Flowchart

Concepts

Definition
An algorithm is a finite set of instructions to specify a
sequence of operations to be carried out in order to solve a
specific problem.

Definition
A program is an implementation of an algorithm in a
programming language (C, C++, Java, etc.)

Marbert John C. Marasigan CS 110 (Foundations of Biocomputing) Lecture 1 Designing Algorithms


Problem Solving
Algorithms
Flowchart

Concepts

Definition
An algorithm is a finite set of instructions to specify a
sequence of operations to be carried out in order to solve a
specific problem.

Definition
A program is an implementation of an algorithm in a
programming language (C, C++, Java, etc.)

Definition
Debugging is the removal of errors from the program.

Marbert John C. Marasigan CS 110 (Foundations of Biocomputing) Lecture 1 Designing Algorithms


Problem Solving
Algorithms
Flowchart

Outline

1 Problem Solving

2 Algorithms

3 Flowchart

Marbert John C. Marasigan CS 110 (Foundations of Biocomputing) Lecture 1 Designing Algorithms


Problem Solving
Algorithms
Flowchart

Algorithms

An algorithm is a procedure for solving a problem in terms of


the actions to be executed and the order in which these actions
are to be executed.

Marbert John C. Marasigan CS 110 (Foundations of Biocomputing) Lecture 1 Designing Algorithms


Problem Solving
Algorithms
Flowchart

Algorithms

An algorithm is a procedure for solving a problem in terms of


the actions to be executed and the order in which these actions
are to be executed.
An algorithm must:
be complete (i.e. all the necessary information must be
contained in it)

Marbert John C. Marasigan CS 110 (Foundations of Biocomputing) Lecture 1 Designing Algorithms


Problem Solving
Algorithms
Flowchart

Algorithms

An algorithm is a procedure for solving a problem in terms of


the actions to be executed and the order in which these actions
are to be executed.
An algorithm must:
be complete (i.e. all the necessary information must be
contained in it)
be unambiguous: every step must only allow one and only
one interpretation

Marbert John C. Marasigan CS 110 (Foundations of Biocomputing) Lecture 1 Designing Algorithms


Problem Solving
Algorithms
Flowchart

Algorithms

An algorithm is a procedure for solving a problem in terms of


the actions to be executed and the order in which these actions
are to be executed.
An algorithm must:
be complete (i.e. all the necessary information must be
contained in it)
be unambiguous: every step must only allow one and only
one interpretation
terminate after a finite number of operations

Marbert John C. Marasigan CS 110 (Foundations of Biocomputing) Lecture 1 Designing Algorithms


Problem Solving
Algorithms
Flowchart

Algorithms

Example: The rise-and-shine algorithm of an executive for


getting out of bed and going to work:
1 Get out of bed
2 Take off pajamas
3 Take a shower
4 Get dressed
5 Eat breakfast
6 Carpool to work

Marbert John C. Marasigan CS 110 (Foundations of Biocomputing) Lecture 1 Designing Algorithms


Problem Solving
Algorithms
Flowchart

Expressing Algorithms

There are two ways to express algorithms:


1 Pseudocode

Marbert John C. Marasigan CS 110 (Foundations of Biocomputing) Lecture 1 Designing Algorithms


Problem Solving
Algorithms
Flowchart

Expressing Algorithms

There are two ways to express algorithms:


1 Pseudocode
2 Flowchart

Marbert John C. Marasigan CS 110 (Foundations of Biocomputing) Lecture 1 Designing Algorithms


Problem Solving
Algorithms
Flowchart

Expressing Algorithms

There are two ways to express algorithms:


1 Pseudocode
2 Flowchart

Definition
A pseudocode is an artificial and informal language that helps
programmers develop algorithms. It is similar to everyday
english. It is convenient and user-friendly, but, it is not an actual
computer programming language

Marbert John C. Marasigan CS 110 (Foundations of Biocomputing) Lecture 1 Designing Algorithms


Problem Solving
Algorithms
Flowchart

Outline

1 Problem Solving

2 Algorithms

3 Flowchart

Marbert John C. Marasigan CS 110 (Foundations of Biocomputing) Lecture 1 Designing Algorithms


Problem Solving
Algorithms
Flowchart

Flowchart

Definition
A flowchart is a graphical representation of an algorithm or of
a portion of an algorithm.

Marbert John C. Marasigan CS 110 (Foundations of Biocomputing) Lecture 1 Designing Algorithms


Problem Solving
Algorithms
Flowchart

Flowchart

Definition
A flowchart is a graphical representation of an algorithm or of
a portion of an algorithm.

Notations:

Marbert John C. Marasigan CS 110 (Foundations of Biocomputing) Lecture 1 Designing Algorithms


Problem Solving
Algorithms
Flowchart

Examples

Example
Compute and output the sum, average, and product of the three
numbers A, B, C.

Marbert John C. Marasigan CS 110 (Foundations of Biocomputing) Lecture 1 Designing Algorithms


Problem Solving
Algorithms
Flowchart

Examples

Example
Compute and output the sum, average, and product of the three
numbers A, B, C.

Example
Compute the mean of two numbers. If the mean is greater than
or equal to 60 output PASSED. Otherwise, output FAILED.

Marbert John C. Marasigan CS 110 (Foundations of Biocomputing) Lecture 1 Designing Algorithms


Problem Solving
Algorithms
Flowchart

Examples

Example
Compute and output the sum, average, and product of the three
numbers A, B, C.

Example
Compute the mean of two numbers. If the mean is greater than
or equal to 60 output PASSED. Otherwise, output FAILED.

Example
Determine the smallest of any three numbers.

Marbert John C. Marasigan CS 110 (Foundations of Biocomputing) Lecture 1 Designing Algorithms

Potrebbero piacerti anche