Unlike head and tail,which both run in constant time, init and last need to traverse the whole list to compute their result. They therefore take time proportional to the length of the list.
Unlike head and tail,which both run in constant time, init and last need to traverse the whole list to compute their result. They therefore take time proportional to the length of the list.