Questions tagged [loops]

The tag has no usage guidance.

9 questions
9k views

Time complexity formula of nested loops

I've just begun this stage 2 Compsci paper on algorithms, and stuff like this is not my strong point. I've come across this in my lecture slides. ...
499 views

A puzzle related to nested loops

For a given input $N$, how many times does the enclosed statement executes? for $i$ in $1\ldots N$ loop $\quad$for $j$ in $1\ldots i$ loop \$\quad$$\quadfor k in i\ldots j loop \quad$$...
14k views

What is the asymptotic runtime of this nested loop? [duplicate]

I am trying to analyse the runtime of this algorithm: for(i=1; i < n; i++){ for(j=1; j <= i; j++){ statement1; } } Expanding the ...
539 views

Average-Case Analysis of a Simple Max-Finding Algorithm

Given this piece of code: ...
48 views

Complexity of this function [duplicate]

I have this function ...
3k views

Time complexity of a triple nested loop with squared indices

I have seen this function in past year exam paper. ...
9k views

Triple nested for-loops [duplicate]

Possible Duplicate: A puzzle related to nested loops I am trying to count the exact/total number of iterations the following nested for-loops are executed: ...