# HG changeset patch # User nipkow # Date 1499533422 -7200 # Node ID d2283b15d2caf4ff26bf3f88a883ca70f8be981d # Parent 0c9bba1e8e97fdbd764bd6b9055dc37de5b8592f . diff -r 0c9bba1e8e97 -r d2283b15d2ca Exercises/ex12/ex12.thy --- a/Exercises/ex12/ex12.thy Fri Jul 07 21:00:57 2017 +0200 +++ b/Exercises/ex12/ex12.thy Sat Jul 08 19:03:42 2017 +0200 @@ -24,6 +24,9 @@ fun deq :: "'a queue \ 'a queue" where "deq (xs,ys) = balance (xs, tl ys)" +text \Note that we assume that the size computation in \balance\ only takes constant time. +In reality the time is linear. How would you avoid that?\ + fun t_enq :: "'a \ 'a queue \ nat" where "t_enq a (xs,ys) = 1 + (if size xs + 1 \ size ys then 0 else size xs + 1 + size ys)"