1. typo fix {playfair_cipher.py, AVL.py} · githuba/Python@4fb978c · GitHub
Skip to content

Commit 4fb978c

Browse files
committed
1. typo fix {playfair_cipher.py, AVL.py}
2. Corrected Logic {AVL.py, 104-107} 3. Removed unnecessary semicolons {BellmanFord.py, Dijkstra.py}
1 parent a033150 commit 4fb978c

4 files changed

Lines changed: 21 additions & 21 deletions

File tree

ciphers/playfair_cipher.py

Lines changed: 3 additions & 3 deletions

data_structures/AVL/AVL.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
'''
2-
A AVL tree
3-
'''
1+
"""
2+
An AVL tree
3+
"""
44
from __future__ import print_function
55

66

@@ -101,10 +101,10 @@ def rebalance(self, node):
101101
if height_left > height_right:
102102
left_child = n.left
103103
if left_child is not None:
104-
h_right = (right_child.right.height
105-
if (right_child.right is not None) else 0)
106-
h_left = (right_child.left.height
107-
if (right_child.left is not None) else 0)
104+
h_right = (left_child.right.height
105+
if (left_child.right is not None) else 0)
106+
h_left = (left_child.left.height
107+
if (left_child.left is not None) else 0)
108108
if (h_left > h_right):
109109
self.rotate_left(n)
110110
break

data_structures/Graph/BellmanFord.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ def printDist(dist, V):
77
print(i,"\t",int(dist[i]),end = "\t")
88
else:
99
print(i,"\t","INF",end="\t")
10-
print();
10+
print()
1111

1212
def BellmanFord(graph, V, E, src):
1313
mdist=[float('inf') for i in range(V)]
14-
mdist[src] = 0.0;
14+
mdist[src] = 0.0
1515

1616
for i in range(V-1):
1717
for j in range(V):
@@ -35,13 +35,13 @@ def BellmanFord(graph, V, E, src):
3535

3636

3737
#MAIN
38-
V = int(input("Enter number of vertices: "));
39-
E = int(input("Enter number of edges: "));
38+
V = int(input("Enter number of vertices: "))
39+
E = int(input("Enter number of edges: "))
4040

4141
graph = [dict() for j in range(E)]
4242

4343
for i in range(V):
44-
graph[i][i] = 0.0;
44+
graph[i][i] = 0.0
4545

4646
for i in range(E):
4747
print("\nEdge ",i+1)

data_structures/Graph/Dijkstra.py

Lines changed: 6 additions & 6 deletions

0 commit comments

Comments
 (0)