Module - 5 - Python - Algorithm Development

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 35

COMPUTER FUNDAMENTALS AND

PROGRAMMING
ALGORITHM DEVELOPMENT

A.Y. 2023 - 2024


FIRST SEMESTER
University of Science and Technology of Southern Philippines
OBJECTIVES / INTENDED LEARNING OUTCOMES

At the end of the lesson, students will be able to:

• Students should be able to understand the technical


activities in problem solving
• Students should be able to understand Algorithm
Development
• Students should be able to understand and how to create
or write an algorithm

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


INTRODUCTION

Algorithm development is the act of designing the steps that

solve a particular problem for a computer or any other device to

follow not excluding human being, but in this case computers only

and computer like devices.


WHAT IS ALGORITHM?

Algorithm: In computing (Computer science and Information


Technology) algorithm is a statement(s) outlining the operation
of a computer program, written in something like computer
language but in a more understandable format. In other to be
able to solve a particular problem one must know the steps or
routes to the solution of that problem.

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


WHAT IS ALGORITHM DESIGN?

An algorithm is a series of instructions, often referred to as a “process,” which is to be


followed when solving a particular problem. While technically not restricted by definition, the
word is almost invariably associated with computers, since computer-processed algorithms can
tackle much larger problems than a human, much more quickly. Since modern computing uses
algorithms much more frequently than at any other point in human history, a field has grown up
around their design, analysis, and refinement. The field of algorithm design requires a strong
mathematical background, with computer science degrees being particularly sought-after
qualifications. It offers a growing number of highly compensated career options, as the need for
more (as well as more sophisticated) algorithms continues to increase.

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


WHAT IS ALGORITHM DESIGN?

Step 1: Obtain a description of the problem


This step is much more difficult than it appears. In the following discussion,
the word client refers to someone who wants to find a solution to a problem, and
the word developer refers to someone who finds a way to solve the problem. The
developer must create an algorithm that will solve the client's problem.
The client is responsible for creating a description of the problem, but this is
often the weakest part of the process. It's quite common for a problem
description to suffer from one or more of the following types of defects: (1) the
description relies on unstated assumptions, (2) the description is ambiguous, (3)
the description is incomplete, or (4) the description has internal contradictions.
These defects are seldom due to carelessness by the client. Instead, they are
due to the fact that natural languages (English, French, Korean, etc.) are rather
imprecise. Part of the developer's responsibility is to identify defects in the
description of a problem, and to work with the client to remedy those defects.

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


WHAT IS ALGORITHM DESIGN?

Step 2: Analyze the problem


The purpose of this step is to determine both the starting and ending points for solving the
problem. This process is analogous to a mathematician determining what is given and what must be
proven. A good problem description makes it easier to perform this step.
When determining the starting point, we should start by seeking answers to the following questions:
• What data are available?
• Where is that data?
• What formulas pertain to the problem?
• What rules exist for working with the data?
• What relationships exist among the data values?

When determining the ending point, we need to describe the characteristics of a solution. In other
words, how will we know when we're done? Asking the following questions often helps to determine the
ending point.
• What new facts will we have?
• What items will have changed?
• What changes will have been made to those items?
• What things will no longer exist?

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


WHAT IS ALGORITHM DESIGN?

Step 3: Develop a high-level algorithm


An algorithm is a plan for solving a problem but plans come in several levels
of detail. It's usually better to start with a high-level algorithm that includes the
major part of a solution but leaves the details until later. We can use an everyday
example to demonstrate a high-level algorithm.

Problem: I need to send a birthday card to my brother, Mark.


Analysis: I don't have a card. I prefer to buy a card rather than make one myself.

High-level algorithm:
Go to a store that sells greeting cards
Select a card
Purchase a card
Mail the card

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


WHAT IS ALGORITHM DESIGN?

This algorithm is satisfactory for daily use, but it lacks details that
would have to be added were a computer to carry out the solution.
These details include answers to questions such as the following.

"Which store will I visit?"

"How will I get there: walk, drive, ride my bicycle, take the bus?"

"What kind of card does Mark like: humorous, sentimental, risqué?"

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


WHAT IS ALGORITHM DESIGN?

Step 4: Refine the algorithm by adding more details

A high-level algorithm shows the major steps that need to be followed to solve
a problem. Now we need to add details to these steps, but how much detail
should we add? Unfortunately, the answer to this question depends on the
situation. We have to consider who (or what) is going to implement the algorithm
and how much that person (or thing) already knows how to do. If someone is
going to purchase Mark's birthday card on my behalf, my instructions have to be
adapted to whether or not that person is familiar with the stores in the community
and how well the purchaser known my brother's taste in greeting cards.

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


WHAT IS ALGORITHM DESIGN?

Step 5: Review the algorithm

The final step is to review the algorithm. What are we looking for? First, we
need to work through the algorithm step by step to determine whether or not it
will solve the original problem. Once we are satisfied that the algorithm does
provide a solution to the problem, we start to look for other things. The following
questions are typical of ones that should be asked whenever we review an
algorithm. Asking these questions and seeking their answers is a good way to
develop skills that can be applied to the next problem.

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


ALGORITHM DEVELOPMENT PROCESS?

Problem solving is the act of defining a problem; determining the cause of


the problem; identifying, prioritizing, and selecting alternatives for a solution; and
implementing a solution.

• Define the problem


• Generate alternative solutions
• Evaluate and generate and alternative
• Implement and follow up on the solution

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


ALGORITHM DEVELOPMENT PROCESS?

1. Define the problem


• Differentiate fact from opinion
• Specify underlying causes
• Consult each faction involved for information
• State the problem specifically
• Identify what standard or expectation is violated
• Determine in which process the problem lies
• Avoid trying to solve the problem without data

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


ALGORITHM DEVELOPMENT PROCESS?

1. Define the problem

Diagnose the situation so that your focus is on the problem, not just its
symptoms. Helpful problem-solving techniques include using flowcharts to
identify the expected steps of a process and cause-and-effect diagrams to
define and analyze root causes.

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


ALGORITHM DEVELOPMENT PROCESS?

2. Generate alternative solutions


• Postpone evaluating alternatives initially
• Include all involved individuals in the generating of alternatives
• Specify alternatives consistent with organizational goals
• Specify short- and long-term alternatives
• Brainstorm on others' ideas
• Seek alternatives that may solve the problem

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


ALGORITHM DEVELOPMENT PROCESS?

3. Evaluate and select an alternative


• Evaluate alternatives relative to a target standard
• Evaluate all alternatives without bias
• Evaluate alternatives relative to established goals
• Evaluate both proven and possible outcomes
• State the selected alternative explicitly

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


ALGORITHM DEVELOPMENT PROCESS?

3. Evaluate and select an alternative


Skilled problem solvers use a series of considerations when selecting the best
alternative. They consider the extent to which:
• A particular alternative will solve the problem without causing other
unanticipated problems.
• All the individuals involved will accept the alternative.
• Implementation of the alternative is likely.
• The alternative fits within the organizational constraints.

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


ALGORITHM DEVELOPMENT PROCESS?

4. Implement and follow up on the solution


• Plan and implement a pilot test of the chosen alternative
• Gather feedback from all affected parties
• Seek acceptance or consensus by all those affected
• Establish ongoing measures and monitoring
• Evaluate long-term results based on final solution

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


4 BASIC FLOWCHART SYMBOLS FOR CREATING A FLOWCHART

Whether you're trying to read a flowchart or creating a flowchart, knowing


the most common flowchart symbols and conventions is going to make it a lot
easier.

• Oval
• Rectangle
• Arrow
• Diamond

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


4 BASIC FLOWCHART SYMBOLS FOR CREATING A FLOWCHART

OVAL
An End or Beginning While Creating a Flowchart.

The oval, or terminator, is used to represent the start and end of a process. Use the Gliffy

flowchart tool to drag and drop a terminator symbol and you've got yourself the beginning

of a flowchart and remember to use the same symbol again to show that your flowchart is

complete.

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


4 BASIC FLOWCHART SYMBOLS FOR CREATING A FLOWCHART

RECTANGLE
A Step in the Flowcharting Process

The rectangle is your go-to symbol once you've started flowcharting. It


represents any step in the process you’re diagramming and is the workhorse of
the flowchart diagram. Use rectangles to capture process steps like basic tasks or
actions in your process.
ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING
4 BASIC FLOWCHART SYMBOLS FOR CREATING A FLOWCHART

ARROW
Indicate Directional Flow

The arrow is used to guide the viewer along their flowcharting path. And
while there are many different types of arrow tips to choose from, we
recommend sticking with one or two for your entire flowchart. This keeps your
diagram looking clean, but also allows you to emphasize certain steps in your
process.

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


4 BASIC FLOWCHART SYMBOLS FOR CREATING A FLOWCHART

DIAMOND
Indicate a Decision

The diamond symbolizes that a decision is required to move forward. This


could be a binary, this-or-that choice or a more complex decision with multiple
choices. Make sure that you capture each possible choice within your diagram.

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


INTERMEDIATE & ADVANCED FLOWCHART SYMBOLS

As you know, flowcharts are made up of a sequence of actions, data, services,


and/or materials. They illustrate where data is being input and output, where
information is being stored, what decisions need to be made, and which people
need to be involved. In addition the basic flowchart conventions, rules, and
symbols, these intermediate flowchart symbols will help you describe your
process with even more detail.
• Document Symbols
• Data Symbols
• Input & Output Symbols

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


INTERMEDIATE & ADVANCED FLOWCHART SYMBOLS

DOCUMENT SYMBOLS

Single and multiple document

icons show that there are additional

points of reference involved in your

flowchart. You might use these to

indicate items like “create an

invoice” or “review testing

paperwork.”

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


INTERMEDIATE & ADVANCED FLOWCHART SYMBOLS

DATA SYMBOLS

Data symbols clarify where the data your flowchart references is being
stored. (You probably won’t use the paper tape symbol, but it definitely came in
handy back in the day.)

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


INTERMEDIATE & ADVANCED FLOWCHART SYMBOLS

INPUT & OUTPUT SYMBOLS

Input and output symbols show where and how data is coming in and out
throughout your process.

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


INTERMEDIATE & ADVANCED FLOWCHART SYMBOLS

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


INTERMEDIATE & ADVANCED FLOWCHART SYMBOLS

MERGING AND CONNECTING

SYMBOLS

Agreed-upon merging and

connector symbols make it

easier to connect flowcharts

that span multiple pages.

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


INTERMEDIATE & ADVANCED FLOWCHART SYMBOLS

ADDITIONAL USEFUL FLOWCHART SYMBOLS

The above are a few additional symbols that prove your flowcharting
prowess when put to good use.

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


INTERMEDIATE & ADVANCED FLOWCHART SYMBOLS

ADDITIONAL USEFUL FLOWCHART SYMBOLS

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


INTERMEDIATE & ADVANCED FLOWCHART SYMBOLS

FLOWCHART EXAMPLE

ES106 – COMPUTER FUNDAMENTALS AND PROGRAMMING


END OF PRESENTATION
Thank you for listening!

Any questions?
Nothing is impossible. The word itself says ‘I’m possible!'

— Audrey Hepburn
REFERENCES:
 https://asq.org/quality-resources/problem-solving
 https://www.computersciencedegreehub.com/faq/what-is-algorithm-
design/
 http://entangle-pair.blogspot.com/2014/10/problem-solving-and-
algorithm.html#:~:text=Algorithm%20development%20is%20the%20act,o
nly%20and%20computer%20like%20devices
 https://www.gliffy.com/blog/guide-to-flowchart-symbols
 http://sofia.cs.vt.edu/cs1114-ebooklet/chapter4.html
 http://sofia.cs.vt.edu/cs1114-ebooklet/chapter4.html

You might also like