Skip to content

Commit b20db73

Browse files
Update
1 parent e1da465 commit b20db73

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

Chapter07/heap_sort.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class minHeap:
1+
class MinHeap:
22
def __init__(self):
33
self.heap = [0]
44
self.size = 0
@@ -55,36 +55,28 @@ def heap_sort(self):
5555

5656

5757

58-
h = minHeap()
58+
h = MinHeap()
5959
for i in ( 4, 8, 7, 2, 9, 10, 5, 1, 3, 6):
6060
h.insert(i)
61-
6261
print(h.heap)
6362

6463

65-
h = minHeap()
64+
h = MinHeap()
6665
unsorted_list = [4, 8, 7, 2, 9, 10, 5, 1, 3, 6]
67-
68-
6966
for i in unsorted_list:
7067
h.insert(i)
71-
7268
print("Unsorted list: {}".format(unsorted_list))
7369

7470

7571

7672

7773

78-
h = minHeap()
74+
h = MinHeap()
7975
unsorted_list = [4, 8, 7, 2, 9, 10, 5, 1, 3, 6]
80-
81-
8276
for i in unsorted_list:
8377
h.insert(i)
84-
8578
print("Unsorted list: {}".format(unsorted_list))
8679

87-
8880
print("Sorted list: {}".format(h.heap_sort()))
8981

9082

0 commit comments

Comments
 (0)