Does this algorithm have a name? I've listed three examples of it below. I'm wanting to document some code that uses this algorithm, and I don't know what to call it. My version is way more complicated but it is fundamentally this.
Example 1:
var maxValue = Int32.MinValue;
foreach (var value in new [] {2, 3, 4, 4, -3, 1, 7})
{
if (value > maxValue)
maxValue = value;
}
Example 2:
var minValue = Int32.MaxValue;
foreach (var value in new [] {7, 6, 5, 4, 3, 2, 20, 42})
{
if (value < maxValue)
minValue = value;
}
Example 3:
var mostPrimeFactors = 0;
var valueWithMostPrimeFactors = 0
foreach (var value in new [] {2, 4, 6, 8, 12, 60, 360})
{
var primeFactorCount = GetPrimeFactors(value).Count;
if (primeFactorCount > mostPrimeFactors)
{
mostPrimeFactors = primeFactorCount
mostPrimeFactors = value;
}
}