Updated a GitHub repository
Revised basic Algorithm concept
#Day17 #100DaysOfCode
algorithm to find the largest number among three numbers.

_assuming maximum is the first number. if the 2nd no is larger, then max is the 2nd no. if the 3rd is larger than the 2nd, then max is the 3rd no. Otherwise, when 2nd no is not larger than 1st no, compare it with the 3rd no. if larger, 1st no is still the largest, otherwise 3rd.

_four numbers: find the max of the first three number and compare it with the 4th one

_an array: assuming the 1st no is max, iteratively compare with elements in the list.

find the root of a quadratic equation
check the condition of delta cases.
delta>0: 2 distinct solution, delta=0: double solution, delta=0: no solution.
linear equation: 3 cases.
a=0, b=0: infinite solution, a≠0, b≠0: x=-b/a, a≠0, b=0: x=0

find the factorial of a number. how to write in recursive function.

check whether a number is prime or not. what is the stopping point? ≤n/2, sqrt(n), or i*i≤n. why?implement in both c++ and python. does not stop only when it is a multiple of 2. teacher one said stops when it is a multiple of 3, the program runs faster.

fibonacci sequence, depends on the starting point.

find the greatest common divisor (gcd) or highest common factor (hcf). check whether one is divisible by another or not. if yes, the other (the divisor) is the gcd. if not, start from half of the divident, going backwards. if there’s something that is divisible by both, break the loop.

find the least common multiple (lcm). the maximum lcm is a*b. starts from the larger one and increments till finds something that divides both, breaks the loop.

application: find the least common multiple for the denominators of an array of fractions. find the lcm on the first two. iteratively takes in elements from the array to find other lcm till the end of the array.