Skip to content

Commit 7eb6984

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent d65aecf commit 7eb6984

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

divide_and_conquer/quicksort.py

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def partition(arr, low, high):
1919
# Return the partition point
2020
return i + 1
2121

22+
2223
# Function to implement Quick Sort
2324
def quick_sort(arr, low, high):
2425
if low < high:
@@ -29,6 +30,7 @@ def quick_sort(arr, low, high):
2930
quick_sort(arr, low, pi - 1) # Before partition
3031
quick_sort(arr, pi + 1, high) # After partition
3132

33+
3234
# Driver code to take user-defined input and sort
3335
if __name__ == "__main__":
3436
# Ask the user for input

graphs/kruskal.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
class Graph:
33
def __init__(self, vertices):
44
self.V = vertices # Number of vertices
5-
self.graph = [] # List to store graph edges (u, v, w)
5+
self.graph = [] # List to store graph edges (u, v, w)
66

77
# Function to add an edge to the graph (u -> v with weight w)
88
def add_edge(self, u, v, w):
@@ -73,10 +73,13 @@ def kruskal_mst(self):
7373
for u, v, w in result:
7474
print(f"{u} -- {v} == {w}")
7575

76+
7677
# Example usage
7778
if __name__ == "__main__":
78-
V = int(input("Enter the number of vertices: ")) # Ask user for the number of vertices
79-
E = int(input("Enter the number of edges: ")) # Ask user for the number of edges
79+
V = int(
80+
input("Enter the number of vertices: ")
81+
) # Ask user for the number of vertices
82+
E = int(input("Enter the number of edges: ")) # Ask user for the number of edges
8083

8184
g = Graph(V) # Create a graph with V vertices
8285

0 commit comments

Comments
 (0)