0% found this document useful (0 votes)
2 views

Algorithm

An algorithm is a step-by-step method for solving tasks, working with input lists to produce output lists. Key properties include input, output, precision, fitness, and determination, while performance can be analyzed through space and time complexity. Space complexity can be categorized into constant and linear, depending on the memory requirements during execution.

Uploaded by

tayo idris
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Algorithm

An algorithm is a step-by-step method for solving tasks, working with input lists to produce output lists. Key properties include input, output, precision, fitness, and determination, while performance can be analyzed through space and time complexity. Space complexity can be categorized into constant and linear, depending on the memory requirements during execution.

Uploaded by

tayo idris
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 3

ALGORITHM

Algorithm: This is a step by step approach in solving a task. Algorithm w


orks on input list supplied and gives the output as a list.
There are terms associated with algorithm which are variable, datatype, statement.
A variable hold space in the computer memory, data type (are the field that identify the
type of values stored in the variable, the statement is just line of statement.)
Properties of Algorithms
Input: values supplied through a set
Output: the result after the algorithm has been applied to the set inputted.
Precision and accurate: output result must be correct and precise , no error obtain
Fitness: this is the number of steps applied to the set of inputs to arrive at an output.
Determination: the result must be guaranteed
Performance Analysis of an Algorithm

• Algorithm can be express in different notation. It can be express using


Natural Language
Pseudocode
Flowchart notation
Programming language.
The performance of an algorithm can be analyzed to be efficient and fast if the
algorithm takes less time to execute and consume less memory space.
The performance algorithm can be analyzed using two methods
Space complexity and Time complexity
The Space complexity is the amount of memory space requires by an
algorithm during the course of executing a program. The space to be
considered include space for line of code to be executed , the data space to
hold constant and variable.
Space complexity
• The space complexity can be subdivided into
Constant space complexity and Linear space complexity
Constant space complexity
This is when the program is dealing with a constant value e.g
Fun square (int a)
{
return (a*a) The variable is a
single constant and
} fixed amount of
space is required
Linear space complexity
The space needed for this algorithm has to be calculated.Things to consider when
working with linear is that:
One variable is taken as one ward(two will take one word each)
Array of variable is taken as n word
Sum variable is taken as one word

You might also like