Search⌘ K

Deletion by Position

Explore the process of deleting nodes by their position in a singly linked list. You will understand how to handle deletion when the target node is the head or located elsewhere, and learn to implement this in Python.

We'll cover the following...

We will solve this problem in a very similar way as we have done in the last lesson.

Cases to Consider #

Again, we’ll consider two cases while writing our code:

  1. Node to be deleted is at position 0
  2. Node to be deleted is not at position 0

The overall logic will stay the same as in the previous lesson except that we’ll change the code a bit to cater to position rather than a key. ...