Data Structure Suppose a singly linked list is implemented with references to head and tail node. Also you have a reference to a particular node that is guaranteed not to be the last node in the list. You do not have references to any other nodes (except by following links). Describe an O(1) algorithm to insert a node with a given value k before the specified node (for which the reference was provided). Solution Hi, I have explaned algorithm step by srep. Please let me know in case of any issue. Lets assume that structure of Node class : class Node{ int data; Node next; Node(int d){ data = d; next = null; } } Since given reference can not be last node(according to your question), so we have at least two nodes in Linked List Lets name given refrence Node is : myNode 1. Create a new Node Node newNode = new Node(item); 2. So, insert newNode just after myNode(given refrence) newNode.next = myNode.next; // pointing next of newNode to next node of myNode myNode.next = newNode; // pointing next of myNode to newNode 3. Now, exchange the data of myNode and newNode int temp = myNode.data; myNode.data = newNode.data; newNode.data = item; .