Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Algorithms 2

Public visualization

Algorithms 2

0 stars0🌍 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

Comments

Sign in to join the discussion.

MIT Licensed