What is an Algorithm
What is an Algorithm
Characteristics of an Algorithm
3. Input: An algorithm must take zero or more inputs. Inputs are the
data provided to the algorithm for processing.
Problem:
Algorithm:
1. Start with the first element of the array as the current maximum.
4. After checking all elements, the current maximum will be the largest
number in the array.
Pseudocode:
Algorithm FindMax(arr):
if e > max: // Step 3: Compare each element with the current max
Characteristics in Action:
3. Input: The algorithm takes an array arr as input, which is the list of
numbers.
4. Output: The algorithm outputs the largest number from the array.
Example Execution:
arr = [3, 5, 7, 2, 6]
Conclusion: