Skip to content

Commit 1477e20

Browse files
committed
Correct examples for py min pq
1 parent 12fc51e commit 1477e20

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

python/main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,12 @@
160160
min_pq = MinPQ(A, len(A))
161161
min_pq.build_min_heap()
162162
print('\nafter build_min_heap:', min_pq.A)
163-
min_pq.heap_decrease_key(8, 15)
164-
print('after heap_decrease_key(4 -> 15):', min_pq.A)
163+
min_pq.heap_decrease_key(5, 2)
164+
print('after heap_decrease_key(9 -> 2):', min_pq.A)
165165

166166
A = [15, 13, 9, 5, 12, 8, 7, 4, 0, 6, 2, 1] # cf. Exercise 6.5-2, p. 165
167167
min_pq = MinPQ(A, len(A))
168168
min_pq.build_min_heap()
169169
print('\nafter build_min_heap:', min_pq.A)
170-
min_pq.min_heap_insert(10)
171-
print('after min_heap_insert(10):', min_pq.A)
170+
min_pq.min_heap_insert(6)
171+
print('after min_heap_insert(6):', min_pq.A)

0 commit comments

Comments
 (0)