
24 May
2010
24 May
'10
2:04 p.m.
On Monday 24 May 2010 15:49:35, matthew coolbeth wrote:
It is linear time, implemented roughly as below
delete z [] = [] delete z (x:xs) = if x=z then delete z xs else x:(delete z xs)
delete only deletes the first occurrence, so it's equivalent to delete z (x:xs) | x == z = xs | otherwise = x : delete z xs delete _ [] = [] , it's O(index of z) thus.