
20 Sep
2010
20 Sep
'10
4:53 a.m.
2010/9/18 Daniel Fischer
n_lastn n = reverse . take n . reverse
Which is the most elegant definition, but it's an O(length list) space operation (as are all others proposed so far). T
No!. You forget laziness!. it is 0(n) with n= the parameter passed to n_lastn. It is not O(length list). the reversed and de-reversed elements are just the ones being taken , not the whole list. (please kill me if I´m wrong. I don´t want to live in a world where beauty is inneficient) ;)