Algorithm and Flow Chart Script
Algorithm and Flow Chart Script
RAMOS: Hello everyone I’m Daniel Ramos from BS5AA and in this video I’m going to discuss about the definition
and history of Algorithm.
RAMOS: An algorithm is a set of well-defined instructions in sequence to solve a problem. Algorithms may be
expressed in infinitely many ways so long as the interpreting program performs the same set of instructions.
For example, the way a particular sorting algorithm is written varies from one programming language to
another, even though the individual operations to be carried out remain the same. One of the simplest algorithms in
computer science is the linear search, which searches sequentially through a set of inputs to determine a matching
value.
HISTORY
RAMOS: The concept of algorithm has existed since antiquity. Arithmetic algorithms, such as a division
algorithm, was used by ancient Babylonian mathematicians c. 2500 BC and Egyptian mathematicians c. 1550 BC.
The very basic algorithms were marking schemes that the ancient folks used to keep track of their grain stock and
cattle. This was followed by the advent of the numeric system, and a subsequent evolution of abacus, algebra and
variables followed, giving rise to symbols and rules involved in formulating evaluation systems.
RAMOS: The word algorithm itself is derived from the name of the 9th-century Persian astronomer and
mathematician Muḥammad ibn Mūsā al-Khwārizmī. His works included introducing the decimal positioning
within numeric systems to the Western world, along with the first ever systematic solution of linear and
quadratic equations. In its original, rudimentary form, algorithms, known as algorism, was regarded as rules for
computing calculations and performing arithmetic with Hindu-Arabic numerals. Later, with the Latin translation of
Al-Khwarizmi’s name, algorisms set definite standards for performing computations to execute tasks.
PADRIGUEZ: Now let’s proceed to the characteristics of Algorithm
CHARACTERISTICS OF ALGORITHM:
Finiteness: Any algorithm should complete at one particular time and this is very important for any algorithm
otherwise your algorithm will go in infinite state and it will not complete ever.
Effectiveness: Each line of an algorithm should be essentials. We should try to write in a simple way so it would
be basic.
Input: Every algorithm should take input it can be Zero or one or more. So according to the conditions user can
use.
Output: For any work some output should come, this is must otherwise there is no meaning of any work. In the
same way, each algorithm should generate one or more output.
Generality: The algorithm should be common for the set of input and requirements so the same algorithm can
apply in multiple places according to the user’s requirements.
PADRIGUEZ: Design of Algorithms:- There are different ways to represent an algorithm as given below:
1. Natural Language:- We can write the algorithms in any natural language which is understandable to the
persons..Natural language is a human language. eg. English, Hindi ,French ,Chinese etc.Natural languages are
not a effective language.It is a ambiguous language.It doesn't give a precise idea .
2. Pseudo code:- Pseudo codes gives precise idea for any algorithms.It is unambiguous in nature.There are many
control statements like for ,if,while,do,etc.It gives iterative codes that makes an algorithm effectiveness.We are
generally use this language to write the precise codes.
3. Flow chart:- This another way to write an algorithm to solve step by step problems in graphical manner.We will
learn this technique in details in our coming lectures.
PADRIGUEZ: Before writing any logic in any programming language we should think about the below things:
PADRIGUEZ:
The correctness of the program: Showing that a program is correct means that it does what it is supposed to
do. More formally, our goal is to prove that a program satisfies its specification, that is, it correctly realizes the
prescribed relationship between inputs and outputs. In other words, for each input, the specification tells us what
the program should output as a response.
1. Partial correctness: If the program ever returns a result, it is the correct result.
2. Termination: The program returns.
PADRIGUEZ:
Time: Time is very important everywhere you must have to take care of how much time your algorithm is taking
to complete the work.
Expand: The running time of an algorithm for a specific input depends on the number of operations executed.
The greater the number of operations, the longer the running time of an algorithm.
Complexity: Complexity is a measure which evaluates the order of the count of operations, performed by a
given or algorithm as a function of the size of the input data. To put this simpler, complexity is a rough
approximation of the number of steps necessary to execute an algorithm.
ARRUBIO: There are many types of Algorithms but the fundamental types of Algorithms are:
Recursive Algorithm
Greedy Algorithm
Backtracking Algorithm
This is one of the most interesting Algorithms as it calls itself with a smaller value as inputs which it
gets after solving for the current inputs. In more simpler words, It’s an Algorithm that calls itself repeatedly
until the problem is solved.
Problems such as the Tower of Hanoi or DFS of a Graph can be easily solved by using these Algorithms.
This is another effective way of solving many problems. In Divide and Conquer algorithms, divide the
algorithm into two parts, the first parts divides the problem on hand into smaller subproblems of the same
type. Then on the second part, these smaller problems are solved and then added together (combined) to
produce the final solution of the problem.
In computer, divide and conquer algorithm a design the parallel diagram based on multi brands
recursion. A divide and conquer algorithm marks by recursively breaking down a problem into more sub
problems of the same related types until this simple enough to solve directly.
ARRUBIO: Dynamic Programming Algorithm
These algorithms work by remembering the results of the past run and using them to find new results. In
other words, dynamic programming algorithm solves complex problems by breaking it into multiple simple
subproblems and then it solves each of them once and then stores them for future use.
These algorithms are used for solving optimization problems. In this algorithm, we find a locally optimum
solution (without any regard for any consequence in future) and hope to find the optimal solution at the global
level.
Greedy Algorithm is any algorithm that follows the problem solving heuristic of making the lacking of
optimal choice at each stage.
In this graph a greedy algorithm base to maximize sum of nodes along a fat, from the top to the bottom
because it lacks the foresight to choose suboptimal solution in the current iteration that will allow for the better
solution later.
This is one of the simplest algorithms in the concept. A brute force algorithm blindly iterates all possible
solutions to search one or more than one solution that may solve a function. Think of brute force as using all
possible combinations of numbers to open a safe.
HISTORY
UNDAP: It is not clear who was the true inventor of flowcharts, but the first standardized documentation on flow
chart was first introduced by Frank and Lillian Gilbreth. In 1921, the couple presented the graphic-based method in
a presentation titled: “Process Charts: First Steps in Finding the One Best Way to do Work”, to members of the
American Society of Mechanical Engineers (ASME).
After that, in 1930s, Allan H. Mogensen, an industrial engineer trained some participants in his Work Simplification
Conferences in New York. Participants from this conference such as Art Spinanger and Ben Grahamthen began to
use flowchart in their respective fields, which helped propagate the usage of flowchart.
In 1947, ASME adopted a symbol set derived from Gilbreth’s original work as the “ASME Standard: Operation and
Flow Process Charts.”
In the year 1949, flowchart began to be used for planning computer programs and quickly became one of the most
popular tools in designing computer algorithms and programs. Nowadays, flow chart is an important productivity
tool, serving employees in various industries and functions.
UNDAP: A flowchart is compose of various shapes, and each shapes represents different types of functions. For
example an oval.
UNDAP: In flowchart, an oval or also known as terminal block is used to mark as the start or the end.
UNDAP: the parallelogram shape on the other hand represents the input and the output.
UNDAP: while the rectangle shows the process of the program.
UNDAP: the diamond shape represents the making of the decision
UNDAP: the circle represents as the page-connector.
UNDAP: this shape ids An off-page connector is used when the target is on another page.
UNDAP: this symbol is called a flowline. A flowline shows the process’ direction. Each flowline connects two
blocks.
UNDAP: other symbols in flowchart such as cylinder is use to represent the data file or the database
UNDAP: while a single document represented by a rectangle with a wavy base and the multiple documents
represented by a stack of rectangle with a wavy base.
UNDAP: a manual operation represented by a trapezoid with a longest parallel side at top to represent the
operation or adjustment to process that can only be made manually.
UNDAP: and lastly, the preparation or the initialization represented by an elongated hexagon originally used
differenciates between steps that prepare for work and steps that actually do work.
UNDAP: THERE ARE THREE FUNDAMENTAL CONTROL STRUCTURES IN PROGRAMMING AND THESE ARE THE:
SEQUENCE CONTROL STRUCTURE which refers to the line-by-line- execution,in which
statements are executed sequentially.
EDEXAMPLE: Basic Calculator
UNDAP: This flowchart is an example of a SEQUENCE STRUCTURE.
A PROGRAM IS TO BE DEVELOPED THAT ALLOWS THE USER TO ENTER IN TWO DIFFERENT NUMBERS. THE
SOFTWARE IS TO ADD THE NUMBERS AND DISPLAY THE RESULT. the first shape is the rectangular shape with
curve on its sides that indicates the start of the process, next is the parallelogram which contains an input
Number1=529 and in our second input we have Number2= 256. NOw the rectangle shows the process which is to
“Total = Number1 + Number2” there for we’re going to add the given input of Number1 and Number2 which is
529 + 256 = 785. The next shape which the parallelogram or the output that indicates to “Display Total” and that is
to print the total of the two numbers 529 and 256 which 785. Now that we have our output we can now end the
process.
UNDAP: Second is the Decision Control Structure.
Decision Control Structure depending on whether a condition is TRUE OR FALSE (YES OR NO),
the decision structure may skip the execution
EXAMPLE: Aaswering the Quiz
UNDAP: This flowchart is an example of a Decision Control Structure. In our example after the start, the
parallelogram indicates to “Get quiz answer from user” and after the user give their answer we now can proceed
to the decision block that evaluates the user’s given answer. And after that if the answer is correct the program
will display “Well done!” and if the answer is wrong the progeam will print “Bad luck!” and then end the process.
Loop Control Structure this is a control structure that allows the execution of a block of
statements multiple times until a specified condition is met.
EXAMPLE: