0% found this document useful (0 votes)
15 views25 pages

Narrative Report COMP 212 4

a file conmtains of computer

Uploaded by

Neal Hernandez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views25 pages

Narrative Report COMP 212 4

a file conmtains of computer

Uploaded by

Neal Hernandez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

A Narrative Report on Computer Fundamentals and Programming

First Semester A.Y. 2024 - 2025

ALGORITHM AND FLOWCHART DEVELOPMENT

Submitted By :

Miranda, Jameson Gabriel F.


Barawid, Rob Ryan F.
Lorenzo, Leonard Glenn A.
Eugenio, Emmanuel M.
Dela Cruz, Kenneth
Gueruela, Jan Louie M.
BSCE - 2C

Submitted to:

ENGR. Kenneth Panahon


Course Instructor

AUGUST 2024

1
LEARNING OBJECTIVES :
By the end of this lesson, students should be able to :
A. Define and understand how Algorithm works;
B. Understand what is Flowchart;
C. Differentiate Algorithm and Flowchat;
D. Use Flowchart to represent Algorithm.

I. Algorithm
An algorithm is a set of commands that must be followed for a computer to perform
calculations or other problem-solving operations.According to its formal definition,
an algorithm is a finite set of instructions carried out in a specific order to perform a
particular task. It is not the entire program or code; it is simple logic to a problem
represented as an informal description in the form of a flowchart or pseudocode.

● Problem: A problem can be defined as a real-world problem or real-world instance


problem for which you need to develop a program or set of instructions. An algorithm
is a set of instructions.

● Algorithm: An algorithm is defined as a step-by-step process that will be designed for


a problem.

● Input: After designing an algorithm, the algorithm is given the necessary and desired
inputs.

2
● Processing unit: The input will be passed to the processing unit, producing the desired
output.

● Output: The outcome or result of the program is referred to as the output.

A. How Do Algorithms Work?

Algorithms are step-by-step procedures designed to solve specific problems and perform
tasks efficiently in the realm of computer science and mathematics. These powerful sets of
instructions form the backbone of modern technology and govern everything from web
searches to artificial intelligence. Here's how algorithms work:

● Input: Algorithms take input data, which can be in various formats, such as numbers,
text, or images.

● Processing: The algorithm processes the input data through a series of logical and
mathematical operations, manipulating and transforming it as needed.

● Output: After the processing is complete, the algorithm produces an output, which
could be a result, a decision, or some other meaningful information.

● Efficiency: A key aspect of algorithms is their efficiency, aiming to accomplish tasks


quickly and with minimal resources.

● Optimization: Algorithm designers constantly seek ways to optimize their algorithms,


making them faster and more reliable.

● Implementation: Algorithms are implemented in various programming languages,


enabling computers to execute them and produce desired outcomes.

3
What is the Need for Algorithms?

Scalability - It aids in your understanding of scalability. When you have a sizable real-world
problem, you must break it down into small steps to analyze it quickly.

Performance - The real world is challenging to break down into smaller steps. If a problem
can be easily divided into smaller steps, it indicates that the problem is feasible.

Use of the Algorithms

Algorithms are essential to many disciplines because they offer organized, practical
answers to challenging issues. Here are a few significant applications of algorithms in
various fields:

1. Data Analysis and Machine Learning

Algorithms are used in data analysis and machine learning to find patterns in big datasets and
forecast outcomes. Thanks to machine learning methods like support vector machines,
decision trees, and neural networks, computers can learn from data and improve over time.
These techniques are essential for applications such as recommendation systems, natural
language processing, and picture recognition.

2. Cryptography & Security

Cryptography algorithms safeguard data by using encryption and decryption techniques,


guaranteeing safe data storage and communication. Algorithms such as SHA-256, AES, and
RSA are commonly employed in data integrity maintenance, user authentication, and
sensitive information security. These algorithms comprise the foundation of cybersecurity
measures used in secure communications, data encryption, and online transactions.

4
3. Information Retrieval and Search Engines

Search engines can efficiently index and retrieve pertinent information thanks to search
algorithms such as PageRank and Hummingbird. By prioritizing web pages according to their
significance and relevancy, these algorithms assist users in locating the most relevant
information available online. Effective search algorithms are necessary to manage the
enormous volume of online information.

4. Optimization problems

Optimization methods are utilized to select the optimal answer from various options. In
various industries, including banking, engineering, logistics, and artificial intelligence,
sophisticated issues are resolved using methods like gradient descent, linear programming,
and genetic algorithms. These algorithms increase productivity, reduce expenses, and
optimize resources for operations and decision-making.

5. Genomics and medical diagnostics

Due to their ability to analyze medical images, forecast disease outbreaks, and recognize
genetic changes, algorithms are indispensable in medical diagnostics. Personalized medicine
has been transformed by machine learning algorithms, in particular, which enable the
creation of customized treatment regimens based on each patient's unique genetic profile.
Additionally, algorithms help to speed up the sequencing and interpretation of genomic data,
improving biotechnology and genomics research.

Characteristics of an Algorithm

An algorithm is a methodical process used to solve a task or solve a problem. Several


important factors impact an algorithm's effectiveness:

5
1. Finiteness - An algorithm must always have a finite number of steps before it ends. When
the operation is finished, it must have a defined endpoint or output and not enter an endless
loop.

2. Definiteness - An algorithm needs to have exact definitions for each step. Clear and
straightforward directions ensure that every step is understood and can be taken easily.

3. Input - An algorithm requires one or more inputs. The values that are first supplied to the
algorithm before its processing are known as inputs. These inputs come from a
predetermined range of acceptable values.

4. Output - One or more outputs must be produced by an algorithm. The output is the
outcome of the algorithm after every step has been completed. The relationship between the
input and the result should be clear.

5. Effectiveness - An algorithm's stages must be sufficiently straightforward to be carried out


in a finite time utilizing fundamental operations. With the resources at hand, every operation
in the algorithm should be doable and practicable.

6. Generality - Rather than being limited to a single particular case, an algorithm should be
able to solve a group of issues. It should offer a generic fix that manages a variety of inputs
inside a predetermined range or domain.

6
II. FLOWCHART

A FLOWCHART is a diagram that depicts a process, system or computer algorithm. They


are widely used in multiple fields to document, study, plan, improve and communicate often
complex processes in clear, easy-to-understand diagrams.

Flowcharts to document business processes came into use in the 1920s and ‘30s. In 1921,
industrial engineers Frank and Lillian Gilbreth introduced the “Flow Process Chart” to the
American Society of Mechanical Engineers (ASME).

7
How do flowcharts work?

Flow charts are simple diagrams that map out a process, so that you can easily
communicate it to other people. You can also use them to define and analyze a process, build
a step-by-step picture of it, and then standardize or improve it.

When to use a flowchart?

● To develop understanding of how a process is done


● To study a process for improvement
● To communicate to others how a process is done
● When better communication is needed between people involved with the same
process
● To document a process
● When planning a project

Flowchart Basic Procedure

● Define the process to be diagrammed. Write its title at the top of the work surface.
● Discuss and decide on the boundaries of your process: Where or when does the
process start? Where or when does it end? Discuss and decide on the level of detail to
be included in the diagram.
● Brainstorm the activities that take place. Write each on a card or sticky note.
● Arrange the activities in proper sequence.
● When all activities are included and everyone agrees that the sequence is correct,
draw arrows to show the flow of the process.
● Review the flowchart with others involved in the process (workers, supervisors,
suppliers, customers) to see if they agree that the process is drawn accurately

Characteristics of a Flowchart

● Start and end points. One or more start and end points linked to a core idea, system,
or process.
● Substeps and processes. These guide readers through the entire process or flow, from
the beginning to the end.
● Directional arrows. These indicate the sequence of steps, providing a clear, visual
order.

8
● Decision points. Decision points break charts into multiple directions, allowing for
different outcomes.
● Flowchart symbols. Standardized flowchart symbols represent specific actions within
a system or process.

III. Difference of Algorithm and Flowchart

9
Advantage of Algorithm

1. It follows a certain process that promotes clarity.

2. Since algorithms don’t rely on specific programming languages, even


non-programmers can easily understand them.

3. Every step in an algorithm has its own logical sequence so it is easy to debug.

Disadvantage of Algorithm

1. The phases of an algorithm are similar to writing the final code, making it harder to
debug than a flowchart.

2. It is time-consuming to write the Pseudocode for big problems.

Advantage of Flowchart

1. Using a flowchart to assess a problem is simple and effective.

2. Easy debugging and takes less effort in writing down logic (as it uses symbols).

Disadvantage of Flowchart

1. Time consuming

2. Larger and more complicated problems are difficult to illustrate with flowcharts.

10
Common symbols applied in a Flowchart

IV. TYPES OF ALGORITHM

Algorithms are categorized based on their approach, purpose, or application.

1) Classification By Approach

•Divide and Conquer Algorithm

Divide and Conquer algorithm is a problem-solving strategy that breaks down a


complex problem into smaller, more manageable subproblems, solves each subproblem
individually, and then combines their solutions to address the original problem. Classic
examples of divide and conquer algorithms include Merge Sort, Quick Sort, and Binary

11
Search. These algorithms are efficient because they reduce the problem size at each step,
often resulting in logarithmic or linearithmic time complexity (like O(log n) or O(n log n)).

•Dynamic programming

Dynamic Programming is defined as a computer programming technique where an


algorithmic problem is first broken down into sub-problems, the results are saved, and then
the sub-problems are optimized to find the overall solution — which usually has to do with
finding the maximum and minimum range of the algorithmic query.

•Greedy Algorithm

Greedy algorithm decides what to do in each step, only based on the current situation,
without a thought of how the total problem looks like. In other words, a greedy algorithm
makes the locally optimal choice in each step, hoping to find the global optimum solution in
the end. In Dijkstra's algorithm for example, the next vertex to be visited is always the next
unvisited vertex with the currently shortest distance from the source, as seen from the current
group of visited vertices.So Dijkstra's algorithm is greedy because the choice of which vertex
to visit next is only based on the currently available information, without considering the
overall problem or how this choice might affect future decisions or the shortest paths in the
end.

•Backtracking Algorithm

Backtracking is an algorithmic technique for solving problems by incrementally


building candidates to the solution and abandoning a candidate (backtracking) if it fails to
satisfy constraints. It's commonly used in constraint satisfaction problems, such as the
N-queen problem, maze solving, and finding Hamiltonian paths. The algorithm uses
recursive calls to explore possible solutions through a state-space tree, applying depth-first

12
search. If a partial solution violates constraints, the algorithm backtracks to explore
alternatives.

•BruteForce Algorithm

A brute force algorithm is a simple, comprehensive search strategy that systematically


explores every option until a problem’s answer is discovered. It’s a generic approach to
problem-solving that’s employed when the issue is small enough to make an in-depth
investigation possible. However, because of their high temporal complexity, brute force
techniques are inefficient for large-scale issues.

Examples:

*String Matching Algorithms are techniques used to find the occurrence of a substring
within a larger text. They are crucial in fields like text processing, search engines, and
bioinformatics.

*Simple Search is a straightforward approach where the pattern is compared


character-by-character at each possible position in the text, one by one. Although easy to
implement, it is inefficient for large texts with a time complexity of O(m*n), where m is the
length of the pattern and n is the length of the text.

2) Classification By Purpose

• Searching Algorithms

Searching algorithms are crucial for efficiently finding elements within data structures
like arrays or lists. They are essential in programming, improving both problem-solving and
logical thinking skills. These algorithms are widely used in software development, from
optimizing database queries and search engines to enhancing e-commerce platforms. Mastery

13
of search algorithms is key for optimizing code performance, critical in fields like data
science, AI, and cybersecurity, where they aid in data analysis, pathfinding, and threat
detection. Understanding them also builds a strong foundation for learning advanced
algorithms, technical interviews, and competitive programming, Example of the searching
algorithm are Binary Search, Linear Search

*Linear search is the simplest search algorithm. It works by iterating through each element of
a data structure until it finds the target element or reaches the end of the data structure. It is
straightforward but not the most efficient for large datasets because its time complexity is
O(n), where n is the number of elements in the data structure.

*Binary search is an efficient algorithm for searching sorted data structures. It works by
repeatedly dividing the search range in half using the divide-and-conquer technique. The
search compares the middle element to the target; if they match, the search is successful. If
the target is smaller, the search continues on the left half; otherwise, it moves to the right.
This method drastically reduces comparisons. Note that binary search only works on sorted
data. it is much faster than linear search, making it ideal for large datasets."

• Sort Algorithms

Sorting algorithms are used to arrange data in a particular order, often numerical or
lexicographical. These algorithms can be broadly classified into two categories:
comparison-based and non-comparison-based. Comparison-based sorting algorithms, like
Quick Sort, Merge Sort, and Bubble Sort, compare elements to determine their order.
Non-comparison-based algorithms, such as Counting Sort and Radix Sort, use different
techniques like counting occurrences or exploiting digit properties to sort data. Each sorting
algorithm has unique characteristics and complexities.

14
•Graph algorithm

Graph Algorithm is a set of instructions or a procedure designed to solve a problem or


perform a task on a graph data structure. They're useful in a wide range of applications where
data is represented as a graph, and where finding patterns and relationships in that data is
important.

Examples:

*Depth-First Search (DFS) is an algorithm used for traversing or searching tree or graph data
structures. The algorithm starts at a specified node (often called the root or start node) and
explores as far as possible along each branch before backtracking. DFS uses a stack data
structure, either explicitly or through recursion, to keep track of the nodes to be explored

*Breadth-First Search (BFS) is an algorithm for traversing or searching tree or graph data
structures. It starts at a given node and explores all its neighboring nodes at the present depth
before moving on to nodes at the next depth level. BFS uses a queue data structure to keep
track of the nodes to be explored. Below is the graphical illustration on how Breadth-First
Search done in a Graph.

3) Classification By Application

•String Matching Algorithms

String matching algorithms are fundamental tools in computer science and are widely
used in various applications such as text processing, data mining, information retrieval, and
pattern recognition. These algorithms aim to locate occurrences of a pattern within a larger
text or string.

15
•Cryptographic Algorithms

are methods used to secure data through encryption and decryption, ensuring
confidentiality, integrity, and authenticity in communication and data storage. These
algorithms fall into three main categories:

1. Symmetric-Key Algorithms -The same key is used for both encryption and decryption.

- Examples: AES (Advanced Encryption Standard), DES (Data Encryption Standard),


3DES.

2. Asymmetric-Key Algorithms- Uses a pair of keys – a public key for encryption and a
private key for decryption.

- Examples: RSA, ECC (Elliptic Curve Cryptography), DSA (Digital Signature Algorithm).

3. Hash Function - Converts data into a fixed-size hash value, primarily for integrity checks.

- Examples: SHA-256, MD5, SHA-3.

These algorithms are fundamental to secure communications, digital signatures, and data
protection in various applications like online banking, e-commerce, and secure file sharing.

•Machine Learning Algorithms

Machine learning algorithms are categorized mainly into supervised and unsupervised
learning. Supervised learning uses labeled data to train models for tasks like regression and
classification. Examples include linear regression, logistic regression, decision trees, random

16
forests, Support Vector Machines (SVM), K-Nearest Neighbors (KNN), Naive Bayes, and
neural networks. In contrast, unsupervised learning deals with unlabeled data to uncover
hidden patterns or groupings, using techniques like K-means clustering, hierarchical
clustering, and Principal Component Analysis (PCA). Semi-supervised learning combines a
small amount of labeled data with a large amount of unlabeled data, while reinforcement
learning involves agents learning optimal actions through interactions with an environment,
aiming to maximize rewards. These algorithms underpin various applications, from
predictive analytics to autonomous systems.

•Recursive Algorithms

Recursion is a programming technique where a function calls itself within its own
definition. It is usually used to solve problems that can be broken down into smaller instances
of the same problem. For Example: Towers of Hanoi (TOH), Factorial Calculation and
Fibonacci Sequence etc.

The point which makes Recursion one of the most used algorithms is that it forms the
base for many other algorithms such as Tree traversals, Graph traversals, Divide and
Conquers Algorithms and Backtracking algorithms.

•Iterative Algorithm

The iterative algorithm is a method of continuously recursing new values of variables


from the old values. In UAV trajectory planning, commonly used iterative algorithms include
block coordinate descent (BCD), successive convex approximation (SCA) and simulated
annealing (SA).

17
•Parallel algorithms

Parallel Algorithms solve problems by dividing tasks into smaller, concurrent subtasks
that can be executed simultaneously across multiple processors or cores. This approach
enhances efficiency and handles larger datasets effectively. Examples include parallel sorting
algorithms, like Parallel Merge Sort, which speed up the sorting process, and parallel search
algorithms, such as Parallel Binary Search, which improve data retrieval. Parallel matrix
operations handle large matrices efficiently, while parallel graph algorithms speed up tasks
like graph traversal. The MapReduce framework divides data processing into "map" and
"reduce" stages for large-scale tasks. Divide and conquer strategies also use parallel
processing to break down problems into smaller parts, solve them concurrently, and combine
the results. These algorithms are essential for leveraging multi-core and distributed
computing systems.

V. Preparation of Flow Chart


Before making flowcharts, we must first understand what they are. In simple
terms, flowchart or flow chart, is a type of diagram that describe processes. These diagrams
compose of symbols, often rectangular, connected by arrows.

Step 1 - Determine The Purpose Or Function

For visualizing abstract processes, it is necessary to determine the purpose of the flowchart.
This helps in choosing the suitable types of process maps to build.

18
Designers can employ one of the following main flow chart types: ‍

1. Process Flowchart: As the most common type, a process flowchart illustrates the steps of
plans, projects, production processes, etc. It visualizes and explains how something is done
from start to end so that teammates, managers, an external team, and other viewers
understand business processes.

2. Workflow Chart: These organizational charts indicate the flow of materials and data in an
organization. It works wonders in training newbies, identifying problems in the workflow,
planning new procedures, or explaining business operations.

19
3. Swimlane Flowchart: The purpose of this graphical representation is to clarify the
interaction process between different employees, departments, and processes, such as sales
process steps that involve other parts of a business. Each diagram can consist of six or more
swimlanes.

20
Step 2 - Map out major steps using flowchart symbols

This step involves listing out all the phases and assigning the proper shapes to each of them.

Different process maps comprise varied components, depending on their type, purpose, and
content. The following are some of the most popular elements used in basic process mapping:

Flowchart Symbols

1. All flowcharts begin with the START symbol. This shape is called a terminator.

2. INPUTS, such as materials or components. eg Printed Circuit Board (PCB)

3. PROCESSES, such as activities or tasks, are sometimes used to link to a subroutine


(another flowchart) with more detailed steps, egdrill Printed Circuit Board(PCB)

21
4. The DECISION symbol checks a condition before carrying on, eg is the drilling
accurate?

5. OUTPUTS, egPrinted Circuit Board(PCB) with holes drilled.

6. All flowcharts end with the END symbol. This shape is called a terminator.

Step 3 - Place The Components In Order

Now that all the components have been visualized, the next step is to place the steps in the
correct order to sketch out the basic process map.

In addition, the diagram maker needs to add lines and arrows to illustrate the direction of
flow and the relations between critical elements.

Although the entire process is close to finishing, there may be changes in this process step,
such as alternating the step order and adding components. Also, remember to use keywords
and phrases only, do not write an entire sentence in each box.

Once all the flow lines and terminal symbols are added, you now have a complete flowchart,
ready for review.

Step 4 - Review & Improve The Flowchart


After a series of steps, the flowchart has already come to life with the complete flow, actions,
and components. However, a thorough review is essential to spot errors and improve the
process flowchart.

An excellent way to assess the flowchart is to get help from people unfamiliar with the
process. Ask them to view the diagram and determine whether they understand what it is
supposed to convey.

22
VI. Use Flowchart To Represent Algorithm

Understanding Flowcharts

A flowchart is a diagrammatic representation of a process or algorithm. It uses various


symbols to denote different types of operations or steps, connected by arrows indicating the
flow of control. Each symbol in a flowchart represents a specific type of action, such as a
decision, process, input/output, or the beginning/end of the algorithm. The most common
symbols include:

Oval (Start/End): Represents the starting or ending point of the algorithm.


Rectangle (Process): Denotes a process or an operation that needs to be performed.
Diamond (Decision): Represents a decision point, where the algorithm branches based on a
condition.
Parallelogram (Input/Output): Indicates an input to or output from the algorithm.
Arrows: Show the direction of the flow of control from one step to another.

Example:
Write an algorithm and flowchart to find the area of the rectangle.

Algorithm:
Step 1: Start
Step 2: Input l & w
Step 3: Area = l x w
Step 4: Print Area
Step 5: Stop

23
VII. References
Ensmenger, (2016) "The multiple meanings of a flowchart."
utexaspressjournals.org

Zen Flowchart.How to make flow chart in 5 steps.


https://www.zenflowchart.com/how-to-make-flowcharts

Smartdraw (1994-2024) “Flowchart Symbols.”


smartdraw.com

Introduction To Computing : Introduction To Data Structures and Algorithms

W3 Schools
https://www.w3schools.com/dsa/dsa_intro.php

Sébastien Heymann (2013) Linkurious


https://linkurious.com/graph-algorithms/

Chiradeep Basumallick, India


https://www.spiceworks.com/tech/devops/articles/what-is-dynamic-programming/amp/

Soni Upadhyay (2023)


https://www.simplilearn.com/tutorials/data-structure-tutorial/backtracking-algorithm#:
~:text=Backtracking%20is%20an%20algorithmic%20technique,meet%20them%20wil
l%20be%20removed.

Geek For Geeks Organization


https://www.geeksforgeeks.org/introduction-to-recursion-2/

Rooha Masroor, ... Waleed Ejaz, in Ad Hoc Networks, 2021


https://www.sciencedirect.com/topics/computer-science/iterative-algorithm

24
Difference Between Algorithm and Flowchart
https://www.geeksforgeeks.org/difference-between-algorithm-and-flowchart/

Lucidchart. (n.d.). What is a flowchart? A beginner's guide. Lucidchart. Retrieved


August 20, 2024, from https://www.lucidchart.com/pages/what-is-a-flowchart-tutorial

Figma. (n.d.). Types of flow charts. Figma. Retrieved August 20, 2024, from
https://www.figma.com/resource-library/types-of-flow-charts/

American Society for Quality. "Flowchart." ASQ, American Society for Quality, n.d.,
https://asq.org/quality-resources/flowchart#:~:text=A%20flowchart%20is%20a%20pic
ture,process%2C%20or%20a%20project%20plan

25

You might also like