Computer Science, asked by toukirahmed755, 1 month ago

Contract an algorithm to delete the first node of a linear linked list and display the update linked list.

Answers

Answered by rajankarkalpana
0

Answer:

The basic principle is to unlink the node. Effectively you just change the pointer of the previous / next nodes so they now point to one node further on instead of the one you wish to delete. That’s it, the node is no longer part of the list, you can do whatever you wish with it, including releasing its allocated RAM or using it in something else.

Explanation:

Obtain a reference of the next node of D, call this (say) N.

If P is null, you’re at the head. Set head to point to N. You’re done, stop here.

Else. Set P’s next to point to N.

Similar questions