The imperative-programming tag has no wiki summary.
1
vote
1answer
118 views
Asymptotic time complexity of a two-loop program
I have two pieces of code in a function which I'm trying to calculate the asymptotic running time for:
...
5
votes
5answers
1k views
Is it possible to find the nth term of a Fibonacci sequence using a definitive for loop?
I'm using the book Introduction to Computer Science by John Zelle and at the end of Chapter 3 (Computing with numbers), I'm asked to find the nth term of a Fibonacci sequence presumably using a ...
4
votes
1answer
119 views
termination of two concurrent threads with shared variables
We're in a shared memory concurrency model where all reads and writes to integer variables are atomic.
do: $S_1$ ...
1
vote
1answer
100 views
Double-nested loop with bitwise operation
I have this little exercise:
for ( i = 0; i < 2 * n; i += 2 )
for ( j = 1; j <= n; j <<= 1 )
if ( j & i )
foo ();
(...