Skip to content

[Chapter 1] EXERCISE 5, infinite loop #22

@dudehydra

Description

@dudehydra

function someFunction(n) {
for (var i = 0; i < n; i * 2) {
console.log(n);
}
}
'answer: O(log_2n)';

i * 2, when i=0, always gives 0, so this is an endless loop, not O(log_2n) O(log_2n)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions