瀏覽代碼

Updated heap.py

luislopez66 2 年之前
父節點
當前提交
05bfd2be7e
共有 1 個檔案被更改,包括 3 行新增3 行删除
  1. 3
    3
      heap.py

+ 3
- 3
heap.py 查看文件

10
 # i. Also, n is the size of a heap and arr is array.
10
 # i. Also, n is the size of a heap and arr is array.
11
 
11
 
12
 def heapify(lista, n, i):
12
 def heapify(lista, n, i):
13
-		# largest is root for now
13
+        # largest is root for now
14
 		largest = i
14
 		largest = i
15
 
15
 
16
 		# left child of root
16
 		# left child of root
17
-		left = 2 * i + 1
17
+		l = 2 * i + 1
18
 
18
 
19
 		# right child of root
19
 		# right child of root
20
-		right = 2 * i + 2
20
+		r = 2 * i + 2
21
 
21
 
22
 		# Checks if root has a left child and is greater
22
 		# Checks if root has a left child and is greater
23
 		# than root
23
 		# than root