Question: 3. Consider a singly linked list with only a pointer to the first node in the list (i.e. there is no length field or pointer

3. Consider a singly linked list with only a pointer to the first node in the list (i.e. there is no length field or pointer to the last node in the list). Express the worst-case asymptotic time complexity, using big-o notation, of efficient implementations of the following operations. Make your bounds as tight as possible (5 points). a. append(x) - creates a new node with the value x and adds it to the end of list 1st. b. prepend(x) - creates a new node with the value x and adds it to the beginning of list lst. C. contains(x) -returns true if a node in the list 1st contains a value equal to x, and false otherwise. d. removeFirst() - removes the first node in the list 1st. e. removeLast() - removes the last node in the list 1st. f. remove(p) - removes the node pointed to by p from the list 1st. g. length() - returns the length of the list 1st
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
