Algorithms 2
✓ Published0🌍 Public
This example compares two algorithms for summing integers from 1 to n: a loop-based approach and a direct mathematical formula. The page displays the console output of both functions, `addNumbers` and `addNumbersFormula`, for n=10, showing that both return the same result. The plain HTML body sets a 13em font size, while the JavaScript uses standard `console.log` calls to print the labeled results. The visualization emphasizes algorithmic efficiency by contrasting the loop’s O(n) time complexity against the formula’s constant-time execution.
AI-generated descriptionMIT Licensed