Bloomberg L.P. Interview Question: There is a linked list, only ... | Glassdoor

Interview Question

Financial Software Developer Interview New York, NY

There is a linked list, only given the pointer of one node

  , how to delete that node in the linked list.
technical, algorithm

Interview Answer

3 Answers


I guess it refers to a single linked list.

iterate unti item->next = toDelete, item->next = toDelete->next, delete(toDelete).

ektor on Sep 12, 2012

void deleteNode(struct node *node_ptr)
   struct node *temp = node_ptr->next;
   node_ptr->data = temp->data;
   node_ptr->next = temp->next;

Anonymous on Oct 5, 2012

First answer I dont think is right, since we can only iterate through the nodes after the given node, not from beginning,

Anonymous on Feb 19, 2016

Add Answers or Comments

To comment on this, Sign In or Sign Up.