public myDLNode search(T e) { myDLNode index; boolean found; index = head; found = false; while(index != null && !found) { if(index.getElement() == e) { found = true; } else { index = index.next; } } return index; }// – searches for the first occurrence of element e in the linked list. It returns the corresponding node in the list; O(n) public myDLNode searchAfter(myDLNode p, T e) throws InvalidPositionException { if((p == null) || (p == tail)) { throw new InvalidPositionException("searchAfter."); } myDLNode index; boolean found; index = tail; found = false; while(index != p && !found) { if(index.getElement() == e) { found = true; } else { index = index.prev; } } return index; }// throws InvalidPositionException – searches for the first occurrence of element e after node p (not including node p). It returns the corresponding node in the list public myDLNode searchBefore(myDLNode p, T e) throws InvalidPositionException { if((p == null) || (p == head)) { throw new InvalidPositionException("searchBefore."); } myDLNode index; boolean found; index = head; found = false; while(index != p && !found) { if(index.getElement() == e) { found = true; } else { index = index.next; } } return index; }// throws InvalidPositionException – searches for the first occurrence of element e before node p (not including node p). It returns the corresponding node in the list. public myDLNode searchAfter(myDLNode p, T e, int i) throws InvalidPositionException { if((p == null) || (p == tail)) { throw new InvalidPositionException("searchAfter."); } myDLNode index; int found; index = tail; found = 0; while(index != p && found != i) { if(index.getElement() == e) { found++; } else { index = index.prev; } } return index; }// - searches for the ith occurrence of element e in the linked list after node p and not including p. It returns the corresponding node in the list.