To determine the worst-case time complexity of the functions SLLdel and DLLdel, let's analyze the operations involved in deleting a node from a singly-linked list (SLL) and a doubly-linked list (DLL).
Singly-Linked List Deletion (SLLdel):
A singly-linked list node contains a pointer to the next node. To delete a node from an SLL, we need to update the previous node's next pointer to skip the node to be deleted. However, without backward pointers, we must first traverse the list to find the node preceding the node we want to delete. This traversal requires up to \( n-1 \) steps in the worst case.
Therefore, the time complexity of SLLdel in the worst case is \( O(n) \).
Doubly-Linked List Deletion (DLLdel):
A doubly-linked list node contains pointers to both the next and previous nodes. When deleting a node from a DLL, we can access both the previous and next nodes directly, thanks to the backward pointers. Consequently, we can update the pointers of the neighboring nodes in constant time without any need for traversal.
Thus, the time complexity of DLLdel in the worst case is \( O(1) \).
After considering these operations, we conclude that the correct statement is: SLLdel is \( O(n) \) and DLLdel is \( O(1) \).
SLLdel is \( O(n) \) and DLLdel is \( O(1) \).