/recursive
void f()
{
if(cond == false)
return;
f();
g();
}
//iterative
public void iterative_f() {
int count = 0;
while (cond == false)
{
count++;
}
while(count > 0)
{
g();
count--;
}
Subscribe to:
Post Comments (Atom)
Design and implementation of interesting data structures and algorithms. You may find it useful either in your computer science course curriculum or in technical interviews of companies like Microsoft, Amazon, Google, Yahoo, Sun, Oracle etc
No comments:
Post a Comment