29.08.2013 Views

Programkonstruktion och Datastrukturer

Programkonstruktion och Datastrukturer

Programkonstruktion och Datastrukturer

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Övningar<br />

● Hitta tidskomplexiteten för följande funktioner:<br />

fun foo([]) = 0<br />

| foo(f::r) = 1 + foo(r);<br />

fun bar([]) = 2<br />

| bar(f::r) = foo(r) + bar(r);<br />

fun baz(0) = 42<br />

| baz(n) = baz(n div 2) + baz(n div 2);

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!