You are on page 1of 3

1.1 Define what is algorithm.

An algorithm is a set of instructions that can help you solve a problem quickly. Algorithms
are easy to understand and can be used to solve problems in a specific order, making them
very helpful for computers.

In simple, an algorithm could be a set of commands that must be taken after for a computer to
perform calculations or other problem-solving operations.

According to its formal definition, a calculation could be a limited set of instructions carried
out in a particular arrange to perform a specific assignment.

It isn't the whole program or code; it is basic logic to an issue spoken to as a casual
representation within the frame of a flowchart or pseudocode.

To obtain set of
Input rules from expected Output
output from the give
input.

Algorithm

According to the above diagram, below is a simple explanation on the complexity of an


algorithm.

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


for which a program or set of instructions must be developed. An algorithm is a set of
instructions.

Algorithm: An algorithm is defined as a step-by-step process developed for a problem.

Input: After designing the algorithm, the necessary and desired inputs are given to the
algorithm.

Processing unit: Inputs are passed to a processing unit that produces the desired output.
Output: The results or results of the program are called outputs.

1.2 Outline the characteristics of a good algorithm.

Finiteness: The algorithm has a finite number of steps and must terminate after a finite
amount of time.

Input: Algorithms can have many inputs or no inputs at all.

Output: You should get at least one output.

Definiteness: Each step should be clear, well defined and precise. There should be no
ambiguity.

Effectiveness: Each step should be simple and take a limited amount of time.

1.3 The algorithms to display the Fibonacci series and the factorial value for a give
number using Pseudo code.

a) The Fibonacci series

x=int(input("enter the number: "))


def fibonacci(i):
if i == 0:
return 0
elif i==1:
return 1
else:
return fibonacci(i-2)+ fibonacci(i-1)
for x in range(x):
print(fibonacci(x))
b) The Factorial value
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n-1)
n=int(input("Input a number to factiorial : "))
print(factorial(n))

1.4 The process of software cycle.

You might also like