Skip to main content
100%

Algorithms 2

✓ Published0🌍 Public
NNita
Last edited Sep 22, 2021
Created on Sep 22, 2021
Forked from HTML Starter

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 description
MIT Licensed

Similar vizzes