All Questions

Filter by
Sorted by
Tagged with
4
votes
2answers
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. ...
6
votes
3answers
20k 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 ...
0
votes
2answers
557 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$$\quad$for $k$ in $i\ldots j$ loop $\quad$$...
1
vote
3answers
929 views

Average-Case Analysis of a Simple Max-Finding Algorithm

Given this piece of code: ...
0
votes
0answers
48 views

Complexity of this function [duplicate]

I have this function ...
2
votes
1answer
3k views

Time complexity of a triple nested loop with squared indices

I have seen this function in past year exam paper. ...
7
votes
2answers
2k views

Looping and branching with Algorithmic Differentiation

Algorithmic (aka Automatic) Differentiation is a wonderful technique for numerical computation of derivatives. I understand how it relates to the fact that we know how to deal with every elementary ...
0
votes
1answer
120 views

Time Complexity of the below code? [duplicate]

here is a nested loop where all the variable are integers.This is another question to the thread. I understood the solution part , but stuck in the time-complexity part. What is the time complexity ...