From 20d36f661bb269b64ca0f134954bfce1e47a7926 Mon Sep 17 00:00:00 2001 From: srilekha279 <158455553+srilekha279@users.noreply.github.com> Date: Thu, 27 Jun 2024 22:06:20 +0530 Subject: [PATCH] Update linked-list.md --- contrib/ds-algorithms/linked-list.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/ds-algorithms/linked-list.md b/contrib/ds-algorithms/linked-list.md index 31cd2e5..59631e7 100644 --- a/contrib/ds-algorithms/linked-list.md +++ b/contrib/ds-algorithms/linked-list.md @@ -167,10 +167,10 @@ check the list is empty otherwise shift the head to next node. temp = self.head while(temp): nextNode = temp.next #Store the next node - temp.next = prev #Reverse the pointer of current node - prev = temp #Move `prev` one step forward - temp = nextNode #Move `temp` one step forward. - self.head = prev #Update the head pointer to last node + temp.next = prev # Reverse the pointer of current node + prev = temp # Move prev pointer one step forward + temp = nextNode # Move temp pointer one step forward. + self.head = prev # Update the head pointer to last node ``` ### Search in a linked list