Professional Documents
Culture Documents
Algorithm-
A process or set of rules to be followed in calculations or other problem-
solving operations, especially by a computer. An algorithm is a procedure or
formula for solving a problem, based on conductiong a sequence of
specified actions. A computer program can be viewed as an elaborate
algorithm. As an effective method, an algorithm can be expressed within a
finite amount of space and time[1] and in a well-defined formal language [2] for
calculating a function. An informal definition could be "a set of rules that
precisely defines a sequence of operations." [18] which would include all
computer programs, including programs that do not perform numeric
calculations.
A programming algorithm is a computer procedure that is a lot like a
procedure and tells your computer precisely what steps to take to solve a
problem or reach a goal. The ingredients are called inputs, while
the results are called the outputs.
Example- find the largest
Algorithm LargestNumber
Input: A list of numbers L.
Output: The largest number in the list L.
if L.size = 0 return null
largest ← L[0]
for each item in L, do
if item > largest, then
largest ← item
return largest
Examples:
Print "passed"
else
Print "failed"
Step 1: Start
Step 4: Add num1 and num2 and assign the result to sum.
sum←num1+num2
Step 6: Stop
Step 1: Start
If a>c
Else
Else
If b>c
Else
Step 5: Stop
Flowcharts-
Flowchart is a diagrammatic representation of an algorithm. Flowcharts are
very helpful in writing program and explaining program to others.
A flowchart is a type of diagram that represents an algorithm, workflow or
process. The flowchart shows the steps as boxes of various kinds, and their
order by connecting the boxes with arrows.
different page.
Flowchart: