File tree 1 file changed +3
-3
lines changed
data_structures/LinkedList
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ def __int__(self, data):
9
9
10
10
class Linked_List :
11
11
def insert_tail (Head , data ):
12
- if ( Head .next is None ) :
12
+ if Head .next is None :
13
13
Head .next = Node (data )
14
14
else :
15
15
Head .next .insert_tail (data )
@@ -43,7 +43,7 @@ def delete_tail(Head): # delete from tail
43
43
if Head is not None :
44
44
tamp = Node ()
45
45
tamp = Head
46
- while ( tamp .next ) .next is not None : # find the 2nd last element
46
+ while tamp .next .next is not None : # find the 2nd last element
47
47
tamp = tamp .next
48
48
# delete the last element by give next None to 2nd last Element
49
49
tamp .next = None
@@ -56,7 +56,7 @@ def reverse(Head):
56
56
prev = None
57
57
current = Head
58
58
59
- while ( current ) :
59
+ while current :
60
60
# Store the current node's next node.
61
61
next_node = current .next
62
62
# Make the current node's next point backwards
You can’t perform that action at this time.
0 commit comments