is more involved thansFind
: given a value to insert, a lookup to insert the new value before, and the head of a linked list return the updated linked list. As with our find method, the pitfall here is traversing the entire linked list without finding the provided lookup. Additionally, we need to handle the edge-case of inserting before the head. See figure 2.7.