Question-40
Python
Data Structure
Linked List
Consider an implementation of a singly linked list, where each node is created using the given class Node
. Suppose it has a head
pointer that points to the first node of the linked list and a tail
pointer that points to the last element of the linked list.
Suppose we want to perform the following operations on the given linked list:-
- Insertion of the new node at the front of the linked list.
- Insertion of the new node at the end of the linked list.
- Deletion of the first node of the linked list.
- Deletion of the last node of the linked list.
Which of the following option represents the correct complexity for each operation?
Answer