00:01
In this question, let's write a program for reversing a singly linked list, single linked list, linked list using three pointers, pointers, that is previous, current and next.
00:47
So here is a step by step explanation of this process.
00:52
First one, initialize three pointers, three pointers, previous to null, current to head of the linked list, head of linked list and next to null.
01:34
Okay, next iteration should be done through the linked list using a loop.
01:44
So next third step is inside the loop before changing the next to pointer, next pointer of current, store the next node in the next variable.
02:02
This step is essential because once we reverse the pointer, we will lose the original next node reference.
02:11
So, how we write is next node, next node is equal to current dot next.
02:22
Okay, so fourth step is update the next pointer of current, current to point the previous node, that is current dot next is equal to previous.
03:13
Okay, in this way we represent this step reverses the direction of the pointer for the current.
03:21
Now, let's point to the previous node instead of the next node.
03:26
So, how we write current dot next is equal to previous.
03:33
So, the fifth step is update the previous pointer to the current node, previous pointer to the current node and current to the next node using the next variable, the next variable.
04:19
This prepares previous and current for the next iteration of the loop...