| 1. |
How Would You Remove A Node From A Doubly Linked List? |
|
Answer» This is ONE of the frequently asked linked list interview QUESTIONS, mostly asked freshers and computer science college graduates. In order to remove a node from the doubly linked list, you need to go through that node and then change the links so that it points to the next node. Removing nodes from head and tail is easy in linked list but removing a node from the middle of the linked list requires you to travel to the node hence take O(n) time. If you want to learn more about BASIC operations on linked list DATA structure, please read a GOOD book on Data Structure and Algorithms e.g. Introduction to Algorithms by Thomas H. Carmen. This is one of the frequently asked linked list interview questions, mostly asked freshers and computer science college graduates. In order to remove a node from the doubly linked list, you need to go through that node and then change the links so that it points to the next node. Removing nodes from head and tail is easy in linked list but removing a node from the middle of the linked list requires you to travel to the node hence take O(n) time. If you want to learn more about basic operations on linked list data structure, please read a good book on Data Structure and Algorithms e.g. Introduction to Algorithms by Thomas H. Carmen. |
|