|
@@ -38,56 +38,317 @@
|
38
|
38
|
"kind": 2,
|
39
|
39
|
"importPath": "heap",
|
40
|
40
|
"description": "heap",
|
41
|
|
- "peekOfCode": "def heapify(lista, n, i):\n\tlargest = i # Initialize largest as root\n\tl = 2 * i + 1 # left = 2*i + 1\n\tr = 2 * i + 2 # right = 2*i + 2\n\t# See if left child of root exists and is\n\t# greater than root\n\tif l < n and lista[i] < lista[l]:\n\t\tlargest = l\n\t# See if right child of root exists and is\n\t# greater than root",
|
|
41
|
+ "peekOfCode": "def heapify(lista, n, i):\n\t\t# largest is root for now\n\t\tlargest = i\n\t\t# left child of root\n\t\tleft = 2 * i + 1\n\t\t# right child of root\n\t\tright = 2 * i + 2\n\t\t# Checks if root has a left child and is greater\n\t\t# than root\n\t\tif l < n and lista[i] < lista[l] :",
|
42
|
42
|
"detail": "heap",
|
43
|
43
|
"documentation": {}
|
44
|
44
|
},
|
45
|
45
|
{
|
46
|
|
- "label": "\tlargest",
|
|
46
|
+ "label": "\t\tlargest",
|
47
|
47
|
"kind": 5,
|
48
|
48
|
"importPath": "heap",
|
49
|
49
|
"description": "heap",
|
50
|
|
- "peekOfCode": "\tlargest = i # Initialize largest as root\n\tl = 2 * i + 1 # left = 2*i + 1\n\tr = 2 * i + 2 # right = 2*i + 2\n\t# See if left child of root exists and is\n\t# greater than root\n\tif l < n and lista[i] < lista[l]:\n\t\tlargest = l\n\t# See if right child of root exists and is\n\t# greater than root\n\tif r < n and lista[largest] < lista[r]:",
|
|
50
|
+ "peekOfCode": "\t\tlargest = i\n\t\t# left child of root\n\t\tleft = 2 * i + 1\n\t\t# right child of root\n\t\tright = 2 * i + 2\n\t\t# Checks if root has a left child and is greater\n\t\t# than root\n\t\tif l < n and lista[i] < lista[l] :\n\t\t\tlargest = l\n\t\t# Checks if root has a right child and is greater",
|
51
|
51
|
"detail": "heap",
|
52
|
52
|
"documentation": {}
|
53
|
53
|
},
|
54
|
54
|
{
|
55
|
|
- "label": "\tl",
|
|
55
|
+ "label": "\t\tleft",
|
56
|
56
|
"kind": 5,
|
57
|
57
|
"importPath": "heap",
|
58
|
58
|
"description": "heap",
|
59
|
|
- "peekOfCode": "\tl = 2 * i + 1 # left = 2*i + 1\n\tr = 2 * i + 2 # right = 2*i + 2\n\t# See if left child of root exists and is\n\t# greater than root\n\tif l < n and lista[i] < lista[l]:\n\t\tlargest = l\n\t# See if right child of root exists and is\n\t# greater than root\n\tif r < n and lista[largest] < lista[r]:\n\t\tlargest = r",
|
|
59
|
+ "peekOfCode": "\t\tleft = 2 * i + 1\n\t\t# right child of root\n\t\tright = 2 * i + 2\n\t\t# Checks if root has a left child and is greater\n\t\t# than root\n\t\tif l < n and lista[i] < lista[l] :\n\t\t\tlargest = l\n\t\t# Checks if root has a right child and is greater\n\t\t# than root\n\t\tif r < n and lista[largest] < lista[r]:",
|
60
|
60
|
"detail": "heap",
|
61
|
61
|
"documentation": {}
|
62
|
62
|
},
|
63
|
63
|
{
|
64
|
|
- "label": "\tr",
|
|
64
|
+ "label": "\t\tright",
|
65
|
65
|
"kind": 5,
|
66
|
66
|
"importPath": "heap",
|
67
|
67
|
"description": "heap",
|
68
|
|
- "peekOfCode": "\tr = 2 * i + 2 # right = 2*i + 2\n\t# See if left child of root exists and is\n\t# greater than root\n\tif l < n and lista[i] < lista[l]:\n\t\tlargest = l\n\t# See if right child of root exists and is\n\t# greater than root\n\tif r < n and lista[largest] < lista[r]:\n\t\tlargest = r\n\t# Change root, if needed",
|
|
68
|
+ "peekOfCode": "\t\tright = 2 * i + 2\n\t\t# Checks if root has a left child and is greater\n\t\t# than root\n\t\tif l < n and lista[i] < lista[l] :\n\t\t\tlargest = l\n\t\t# Checks if root has a right child and is greater\n\t\t# than root\n\t\tif r < n and lista[largest] < lista[r]:\n\t\t\tlargest = r\n\t\t# If necessary, this changes root by swapping va-",
|
69
|
69
|
"detail": "heap",
|
70
|
70
|
"documentation": {}
|
71
|
71
|
},
|
72
|
72
|
{
|
73
|
|
- "label": "\t\tlargest",
|
|
73
|
+ "label": "\t\t\tlargest",
|
74
|
74
|
"kind": 5,
|
75
|
75
|
"importPath": "heap",
|
76
|
76
|
"description": "heap",
|
77
|
|
- "peekOfCode": "\t\tlargest = l\n\t# See if right child of root exists and is\n\t# greater than root\n\tif r < n and lista[largest] < lista[r]:\n\t\tlargest = r\n\t# Change root, if needed\n\tif largest != i:\n\t\t(lista[i], lista[largest]) = (lista[largest], lista[i]) # swap\n\t\t# Heapify the root.\n\t\theapify(lista, n, largest)",
|
|
77
|
+ "peekOfCode": "\t\t\tlargest = l\n\t\t# Checks if root has a right child and is greater\n\t\t# than root\n\t\tif r < n and lista[largest] < lista[r]:\n\t\t\tlargest = r\n\t\t# If necessary, this changes root by swapping va-\n\t\t# lues\n\t\tlista[i], lista[largest] = lista[largest], lista[i]\n\t\theapify(lista, n, largest)",
|
78
|
78
|
"detail": "heap",
|
79
|
79
|
"documentation": {}
|
80
|
80
|
},
|
81
|
81
|
{
|
82
|
|
- "label": "\t\tlargest",
|
|
82
|
+ "label": "\t\t\tlargest",
|
83
|
83
|
"kind": 5,
|
84
|
84
|
"importPath": "heap",
|
85
|
85
|
"description": "heap",
|
86
|
|
- "peekOfCode": "\t\tlargest = r\n\t# Change root, if needed\n\tif largest != i:\n\t\t(lista[i], lista[largest]) = (lista[largest], lista[i]) # swap\n\t\t# Heapify the root.\n\t\theapify(lista, n, largest)",
|
|
86
|
+ "peekOfCode": "\t\t\tlargest = r\n\t\t# If necessary, this changes root by swapping va-\n\t\t# lues\n\t\tlista[i], lista[largest] = lista[largest], lista[i]\n\t\theapify(lista, n, largest)",
|
87
|
87
|
"detail": "heap",
|
88
|
88
|
"documentation": {}
|
89
|
89
|
},
|
90
|
90
|
{
|
|
91
|
+ "label": "heapify",
|
|
92
|
+ "kind": 2,
|
|
93
|
+ "importPath": "heap_BACKUP_341",
|
|
94
|
+ "description": "heap_BACKUP_341",
|
|
95
|
+ "peekOfCode": "def heapify(lista, n, i):\n<<<<<<< HEAD\n\tlargest = i # Initialize largest as root\n\tl = 2 * i + 1 # left = 2*i + 1\n\tr = 2 * i + 2 # right = 2*i + 2\n\t# See if left child of root exists and is\n\t# greater than root\n\tif l < n and lista[i] < lista[l]:\n\t\tlargest = l\n\t# See if right child of root exists and is",
|
|
96
|
+ "detail": "heap_BACKUP_341",
|
|
97
|
+ "documentation": {}
|
|
98
|
+ },
|
|
99
|
+ {
|
|
100
|
+ "label": "\tlargest",
|
|
101
|
+ "kind": 5,
|
|
102
|
+ "importPath": "heap_BACKUP_341",
|
|
103
|
+ "description": "heap_BACKUP_341",
|
|
104
|
+ "peekOfCode": "\tlargest = i # Initialize largest as root\n\tl = 2 * i + 1 # left = 2*i + 1\n\tr = 2 * i + 2 # right = 2*i + 2\n\t# See if left child of root exists and is\n\t# greater than root\n\tif l < n and lista[i] < lista[l]:\n\t\tlargest = l\n\t# See if right child of root exists and is\n\t# greater than root\n\tif r < n and lista[largest] < lista[r]:",
|
|
105
|
+ "detail": "heap_BACKUP_341",
|
|
106
|
+ "documentation": {}
|
|
107
|
+ },
|
|
108
|
+ {
|
|
109
|
+ "label": "\tl",
|
|
110
|
+ "kind": 5,
|
|
111
|
+ "importPath": "heap_BACKUP_341",
|
|
112
|
+ "description": "heap_BACKUP_341",
|
|
113
|
+ "peekOfCode": "\tl = 2 * i + 1 # left = 2*i + 1\n\tr = 2 * i + 2 # right = 2*i + 2\n\t# See if left child of root exists and is\n\t# greater than root\n\tif l < n and lista[i] < lista[l]:\n\t\tlargest = l\n\t# See if right child of root exists and is\n\t# greater than root\n\tif r < n and lista[largest] < lista[r]:\n\t\tlargest = r",
|
|
114
|
+ "detail": "heap_BACKUP_341",
|
|
115
|
+ "documentation": {}
|
|
116
|
+ },
|
|
117
|
+ {
|
|
118
|
+ "label": "\tr",
|
|
119
|
+ "kind": 5,
|
|
120
|
+ "importPath": "heap_BACKUP_341",
|
|
121
|
+ "description": "heap_BACKUP_341",
|
|
122
|
+ "peekOfCode": "\tr = 2 * i + 2 # right = 2*i + 2\n\t# See if left child of root exists and is\n\t# greater than root\n\tif l < n and lista[i] < lista[l]:\n\t\tlargest = l\n\t# See if right child of root exists and is\n\t# greater than root\n\tif r < n and lista[largest] < lista[r]:\n\t\tlargest = r\n\t# Change root, if needed",
|
|
123
|
+ "detail": "heap_BACKUP_341",
|
|
124
|
+ "documentation": {}
|
|
125
|
+ },
|
|
126
|
+ {
|
|
127
|
+ "label": "\t\tlargest",
|
|
128
|
+ "kind": 5,
|
|
129
|
+ "importPath": "heap_BACKUP_341",
|
|
130
|
+ "description": "heap_BACKUP_341",
|
|
131
|
+ "peekOfCode": "\t\tlargest = l\n\t# See if right child of root exists and is\n\t# greater than root\n\tif r < n and lista[largest] < lista[r]:\n\t\tlargest = r\n\t# Change root, if needed\n=======\n\t# largest is root for now\n\tlargest = i\n\t# left child of root",
|
|
132
|
+ "detail": "heap_BACKUP_341",
|
|
133
|
+ "documentation": {}
|
|
134
|
+ },
|
|
135
|
+ {
|
|
136
|
+ "label": "\t\tlargest",
|
|
137
|
+ "kind": 5,
|
|
138
|
+ "importPath": "heap_BACKUP_341",
|
|
139
|
+ "description": "heap_BACKUP_341",
|
|
140
|
+ "peekOfCode": "\t\tlargest = r\n\t# Change root, if needed\n=======\n\t# largest is root for now\n\tlargest = i\n\t# left child of root\n\tl = 2 * i + 1\n\t# right child of root\n\tr = 2 * i + 2\n\t# Checks if root has a left child and is greater",
|
|
141
|
+ "detail": "heap_BACKUP_341",
|
|
142
|
+ "documentation": {}
|
|
143
|
+ },
|
|
144
|
+ {
|
|
145
|
+ "label": "\tlargest",
|
|
146
|
+ "kind": 5,
|
|
147
|
+ "importPath": "heap_BACKUP_341",
|
|
148
|
+ "description": "heap_BACKUP_341",
|
|
149
|
+ "peekOfCode": "\tlargest = i\n\t# left child of root\n\tl = 2 * i + 1\n\t# right child of root\n\tr = 2 * i + 2\n\t# Checks if root has a left child and is greater\n\t# than root\n\tif l < n and lista[i] < lista[l] :\n\t\tlargest = l\n\t# Checks if root has a right child and is greater",
|
|
150
|
+ "detail": "heap_BACKUP_341",
|
|
151
|
+ "documentation": {}
|
|
152
|
+ },
|
|
153
|
+ {
|
|
154
|
+ "label": "\tl",
|
|
155
|
+ "kind": 5,
|
|
156
|
+ "importPath": "heap_BACKUP_341",
|
|
157
|
+ "description": "heap_BACKUP_341",
|
|
158
|
+ "peekOfCode": "\tl = 2 * i + 1\n\t# right child of root\n\tr = 2 * i + 2\n\t# Checks if root has a left child and is greater\n\t# than root\n\tif l < n and lista[i] < lista[l] :\n\t\tlargest = l\n\t# Checks if root has a right child and is greater\n\t# than root\n\tif r < n and lista[largest] < lista[r]:",
|
|
159
|
+ "detail": "heap_BACKUP_341",
|
|
160
|
+ "documentation": {}
|
|
161
|
+ },
|
|
162
|
+ {
|
|
163
|
+ "label": "\tr",
|
|
164
|
+ "kind": 5,
|
|
165
|
+ "importPath": "heap_BACKUP_341",
|
|
166
|
+ "description": "heap_BACKUP_341",
|
|
167
|
+ "peekOfCode": "\tr = 2 * i + 2\n\t# Checks if root has a left child and is greater\n\t# than root\n\tif l < n and lista[i] < lista[l] :\n\t\tlargest = l\n\t# Checks if root has a right child and is greater\n\t# than root\n\tif r < n and lista[largest] < lista[r]:\n\t\tlargest = r\n\t# If necessary, this changes root by swapping va-",
|
|
168
|
+ "detail": "heap_BACKUP_341",
|
|
169
|
+ "documentation": {}
|
|
170
|
+ },
|
|
171
|
+ {
|
|
172
|
+ "label": "\t\tlargest",
|
|
173
|
+ "kind": 5,
|
|
174
|
+ "importPath": "heap_BACKUP_341",
|
|
175
|
+ "description": "heap_BACKUP_341",
|
|
176
|
+ "peekOfCode": "\t\tlargest = l\n\t# Checks if root has a right child and is greater\n\t# than root\n\tif r < n and lista[largest] < lista[r]:\n\t\tlargest = r\n\t# If necessary, this changes root by swapping va-\n\t# lues\n\t\tlista[i], lista[largest] = lista[largest], lista[i]\n>>>>>>> sortingHeap\n\tif largest != i:",
|
|
177
|
+ "detail": "heap_BACKUP_341",
|
|
178
|
+ "documentation": {}
|
|
179
|
+ },
|
|
180
|
+ {
|
|
181
|
+ "label": "\t\tlargest",
|
|
182
|
+ "kind": 5,
|
|
183
|
+ "importPath": "heap_BACKUP_341",
|
|
184
|
+ "description": "heap_BACKUP_341",
|
|
185
|
+ "peekOfCode": "\t\tlargest = r\n\t# If necessary, this changes root by swapping va-\n\t# lues\n\t\tlista[i], lista[largest] = lista[largest], lista[i]\n>>>>>>> sortingHeap\n\tif largest != i:\n\t\t(lista[i], lista[largest]) = (lista[largest], lista[i]) # swap\n\t\t# Heapify the root.\n\t\theapify(lista, n, largest)",
|
|
186
|
+ "detail": "heap_BACKUP_341",
|
|
187
|
+ "documentation": {}
|
|
188
|
+ },
|
|
189
|
+ {
|
|
190
|
+ "label": "heapify",
|
|
191
|
+ "kind": 2,
|
|
192
|
+ "importPath": "heap_BASE_341",
|
|
193
|
+ "description": "heap_BASE_341",
|
|
194
|
+ "peekOfCode": "def heapify(lista, n, i):\n\t\t# largest is root for now\n\t\tlargest = i\n\t\t# left child of root\n\t\tleft = 2 * i + 1\n\t\t# right child of root\n\t\tright = 2 * i + 2\n\t\t# Checks if root has a left child and is greater\n\t\t# than root\n\t\tif l < n and lista[i] < lista[l] :",
|
|
195
|
+ "detail": "heap_BASE_341",
|
|
196
|
+ "documentation": {}
|
|
197
|
+ },
|
|
198
|
+ {
|
|
199
|
+ "label": "\t\tlargest",
|
|
200
|
+ "kind": 5,
|
|
201
|
+ "importPath": "heap_BASE_341",
|
|
202
|
+ "description": "heap_BASE_341",
|
|
203
|
+ "peekOfCode": "\t\tlargest = i\n\t\t# left child of root\n\t\tleft = 2 * i + 1\n\t\t# right child of root\n\t\tright = 2 * i + 2\n\t\t# Checks if root has a left child and is greater\n\t\t# than root\n\t\tif l < n and lista[i] < lista[l] :\n\t\t\tlargest = l\n\t\t# Checks if root has a right child and is greater",
|
|
204
|
+ "detail": "heap_BASE_341",
|
|
205
|
+ "documentation": {}
|
|
206
|
+ },
|
|
207
|
+ {
|
|
208
|
+ "label": "\t\tleft",
|
|
209
|
+ "kind": 5,
|
|
210
|
+ "importPath": "heap_BASE_341",
|
|
211
|
+ "description": "heap_BASE_341",
|
|
212
|
+ "peekOfCode": "\t\tleft = 2 * i + 1\n\t\t# right child of root\n\t\tright = 2 * i + 2\n\t\t# Checks if root has a left child and is greater\n\t\t# than root\n\t\tif l < n and lista[i] < lista[l] :\n\t\t\tlargest = l\n\t\t# Checks if root has a right child and is greater\n\t\t# than root\n\t\tif r < n and lista[largest] < lista[r]:",
|
|
213
|
+ "detail": "heap_BASE_341",
|
|
214
|
+ "documentation": {}
|
|
215
|
+ },
|
|
216
|
+ {
|
|
217
|
+ "label": "\t\tright",
|
|
218
|
+ "kind": 5,
|
|
219
|
+ "importPath": "heap_BASE_341",
|
|
220
|
+ "description": "heap_BASE_341",
|
|
221
|
+ "peekOfCode": "\t\tright = 2 * i + 2\n\t\t# Checks if root has a left child and is greater\n\t\t# than root\n\t\tif l < n and lista[i] < lista[l] :\n\t\t\tlargest = l\n\t\t# Checks if root has a right child and is greater\n\t\t# than root\n\t\tif r < n and lista[largest] < lista[r]:\n\t\t\tlargest = r\n\t\t# If necessary, this changes root by swapping va-",
|
|
222
|
+ "detail": "heap_BASE_341",
|
|
223
|
+ "documentation": {}
|
|
224
|
+ },
|
|
225
|
+ {
|
|
226
|
+ "label": "\t\t\tlargest",
|
|
227
|
+ "kind": 5,
|
|
228
|
+ "importPath": "heap_BASE_341",
|
|
229
|
+ "description": "heap_BASE_341",
|
|
230
|
+ "peekOfCode": "\t\t\tlargest = l\n\t\t# Checks if root has a right child and is greater\n\t\t# than root\n\t\tif r < n and lista[largest] < lista[r]:\n\t\t\tlargest = r\n\t\t# If necessary, this changes root by swapping va-\n\t\t# lues\n\t\tlista[i], lista[largest] = lista[largest], lista[i]\n\t\t# This heapifies the root repeatedly\n\t\theapify(lista, n, largest)",
|
|
231
|
+ "detail": "heap_BASE_341",
|
|
232
|
+ "documentation": {}
|
|
233
|
+ },
|
|
234
|
+ {
|
|
235
|
+ "label": "\t\t\tlargest",
|
|
236
|
+ "kind": 5,
|
|
237
|
+ "importPath": "heap_BASE_341",
|
|
238
|
+ "description": "heap_BASE_341",
|
|
239
|
+ "peekOfCode": "\t\t\tlargest = r\n\t\t# If necessary, this changes root by swapping va-\n\t\t# lues\n\t\tlista[i], lista[largest] = lista[largest], lista[i]\n\t\t# This heapifies the root repeatedly\n\t\theapify(lista, n, largest)",
|
|
240
|
+ "detail": "heap_BASE_341",
|
|
241
|
+ "documentation": {}
|
|
242
|
+ },
|
|
243
|
+ {
|
|
244
|
+ "label": "heapify",
|
|
245
|
+ "kind": 2,
|
|
246
|
+ "importPath": "heap_LOCAL_341",
|
|
247
|
+ "description": "heap_LOCAL_341",
|
|
248
|
+ "peekOfCode": "def heapify(lista, n, i):\n\tlargest = i # Initialize largest as root\n\tl = 2 * i + 1 # left = 2*i + 1\n\tr = 2 * i + 2 # right = 2*i + 2\n\t# See if left child of root exists and is\n\t# greater than root\n\tif l < n and lista[i] < lista[l]:\n\t\tlargest = l\n\t# See if right child of root exists and is\n\t# greater than root",
|
|
249
|
+ "detail": "heap_LOCAL_341",
|
|
250
|
+ "documentation": {}
|
|
251
|
+ },
|
|
252
|
+ {
|
|
253
|
+ "label": "\tlargest",
|
|
254
|
+ "kind": 5,
|
|
255
|
+ "importPath": "heap_LOCAL_341",
|
|
256
|
+ "description": "heap_LOCAL_341",
|
|
257
|
+ "peekOfCode": "\tlargest = i # Initialize largest as root\n\tl = 2 * i + 1 # left = 2*i + 1\n\tr = 2 * i + 2 # right = 2*i + 2\n\t# See if left child of root exists and is\n\t# greater than root\n\tif l < n and lista[i] < lista[l]:\n\t\tlargest = l\n\t# See if right child of root exists and is\n\t# greater than root\n\tif r < n and lista[largest] < lista[r]:",
|
|
258
|
+ "detail": "heap_LOCAL_341",
|
|
259
|
+ "documentation": {}
|
|
260
|
+ },
|
|
261
|
+ {
|
|
262
|
+ "label": "\tl",
|
|
263
|
+ "kind": 5,
|
|
264
|
+ "importPath": "heap_LOCAL_341",
|
|
265
|
+ "description": "heap_LOCAL_341",
|
|
266
|
+ "peekOfCode": "\tl = 2 * i + 1 # left = 2*i + 1\n\tr = 2 * i + 2 # right = 2*i + 2\n\t# See if left child of root exists and is\n\t# greater than root\n\tif l < n and lista[i] < lista[l]:\n\t\tlargest = l\n\t# See if right child of root exists and is\n\t# greater than root\n\tif r < n and lista[largest] < lista[r]:\n\t\tlargest = r",
|
|
267
|
+ "detail": "heap_LOCAL_341",
|
|
268
|
+ "documentation": {}
|
|
269
|
+ },
|
|
270
|
+ {
|
|
271
|
+ "label": "\tr",
|
|
272
|
+ "kind": 5,
|
|
273
|
+ "importPath": "heap_LOCAL_341",
|
|
274
|
+ "description": "heap_LOCAL_341",
|
|
275
|
+ "peekOfCode": "\tr = 2 * i + 2 # right = 2*i + 2\n\t# See if left child of root exists and is\n\t# greater than root\n\tif l < n and lista[i] < lista[l]:\n\t\tlargest = l\n\t# See if right child of root exists and is\n\t# greater than root\n\tif r < n and lista[largest] < lista[r]:\n\t\tlargest = r\n\t# Change root, if needed",
|
|
276
|
+ "detail": "heap_LOCAL_341",
|
|
277
|
+ "documentation": {}
|
|
278
|
+ },
|
|
279
|
+ {
|
|
280
|
+ "label": "\t\tlargest",
|
|
281
|
+ "kind": 5,
|
|
282
|
+ "importPath": "heap_LOCAL_341",
|
|
283
|
+ "description": "heap_LOCAL_341",
|
|
284
|
+ "peekOfCode": "\t\tlargest = l\n\t# See if right child of root exists and is\n\t# greater than root\n\tif r < n and lista[largest] < lista[r]:\n\t\tlargest = r\n\t# Change root, if needed\n\tif largest != i:\n\t\t(lista[i], lista[largest]) = (lista[largest], lista[i]) # swap\n\t\t# Heapify the root.\n\t\theapify(lista, n, largest)",
|
|
285
|
+ "detail": "heap_LOCAL_341",
|
|
286
|
+ "documentation": {}
|
|
287
|
+ },
|
|
288
|
+ {
|
|
289
|
+ "label": "\t\tlargest",
|
|
290
|
+ "kind": 5,
|
|
291
|
+ "importPath": "heap_LOCAL_341",
|
|
292
|
+ "description": "heap_LOCAL_341",
|
|
293
|
+ "peekOfCode": "\t\tlargest = r\n\t# Change root, if needed\n\tif largest != i:\n\t\t(lista[i], lista[largest]) = (lista[largest], lista[i]) # swap\n\t\t# Heapify the root.\n\t\theapify(lista, n, largest)",
|
|
294
|
+ "detail": "heap_LOCAL_341",
|
|
295
|
+ "documentation": {}
|
|
296
|
+ },
|
|
297
|
+ {
|
|
298
|
+ "label": "heapify",
|
|
299
|
+ "kind": 2,
|
|
300
|
+ "importPath": "heap_REMOTE_341",
|
|
301
|
+ "description": "heap_REMOTE_341",
|
|
302
|
+ "peekOfCode": "def heapify(lista, n, i):\n\t# largest is root for now\n\tlargest = i\n\t# left child of root\n\tl = 2 * i + 1\n\t# right child of root\n\tr = 2 * i + 2\n\t# Checks if root has a left child and is greater\n\t# than root\n\tif l < n and lista[i] < lista[l] :",
|
|
303
|
+ "detail": "heap_REMOTE_341",
|
|
304
|
+ "documentation": {}
|
|
305
|
+ },
|
|
306
|
+ {
|
|
307
|
+ "label": "\tlargest",
|
|
308
|
+ "kind": 5,
|
|
309
|
+ "importPath": "heap_REMOTE_341",
|
|
310
|
+ "description": "heap_REMOTE_341",
|
|
311
|
+ "peekOfCode": "\tlargest = i\n\t# left child of root\n\tl = 2 * i + 1\n\t# right child of root\n\tr = 2 * i + 2\n\t# Checks if root has a left child and is greater\n\t# than root\n\tif l < n and lista[i] < lista[l] :\n\t\tlargest = l\n\t# Checks if root has a right child and is greater",
|
|
312
|
+ "detail": "heap_REMOTE_341",
|
|
313
|
+ "documentation": {}
|
|
314
|
+ },
|
|
315
|
+ {
|
|
316
|
+ "label": "\tl",
|
|
317
|
+ "kind": 5,
|
|
318
|
+ "importPath": "heap_REMOTE_341",
|
|
319
|
+ "description": "heap_REMOTE_341",
|
|
320
|
+ "peekOfCode": "\tl = 2 * i + 1\n\t# right child of root\n\tr = 2 * i + 2\n\t# Checks if root has a left child and is greater\n\t# than root\n\tif l < n and lista[i] < lista[l] :\n\t\tlargest = l\n\t# Checks if root has a right child and is greater\n\t# than root\n\tif r < n and lista[largest] < lista[r]:",
|
|
321
|
+ "detail": "heap_REMOTE_341",
|
|
322
|
+ "documentation": {}
|
|
323
|
+ },
|
|
324
|
+ {
|
|
325
|
+ "label": "\tr",
|
|
326
|
+ "kind": 5,
|
|
327
|
+ "importPath": "heap_REMOTE_341",
|
|
328
|
+ "description": "heap_REMOTE_341",
|
|
329
|
+ "peekOfCode": "\tr = 2 * i + 2\n\t# Checks if root has a left child and is greater\n\t# than root\n\tif l < n and lista[i] < lista[l] :\n\t\tlargest = l\n\t# Checks if root has a right child and is greater\n\t# than root\n\tif r < n and lista[largest] < lista[r]:\n\t\tlargest = r\n\t# If necessary, this changes root by swapping va-",
|
|
330
|
+ "detail": "heap_REMOTE_341",
|
|
331
|
+ "documentation": {}
|
|
332
|
+ },
|
|
333
|
+ {
|
|
334
|
+ "label": "\t\tlargest",
|
|
335
|
+ "kind": 5,
|
|
336
|
+ "importPath": "heap_REMOTE_341",
|
|
337
|
+ "description": "heap_REMOTE_341",
|
|
338
|
+ "peekOfCode": "\t\tlargest = l\n\t# Checks if root has a right child and is greater\n\t# than root\n\tif r < n and lista[largest] < lista[r]:\n\t\tlargest = r\n\t# If necessary, this changes root by swapping va-\n\t# lues\n\t\tlista[i], lista[largest] = lista[largest], lista[i]\n\t\t# This heapifies the root repeatedly\n\t\theapify(lista, n, largest)",
|
|
339
|
+ "detail": "heap_REMOTE_341",
|
|
340
|
+ "documentation": {}
|
|
341
|
+ },
|
|
342
|
+ {
|
|
343
|
+ "label": "\t\tlargest",
|
|
344
|
+ "kind": 5,
|
|
345
|
+ "importPath": "heap_REMOTE_341",
|
|
346
|
+ "description": "heap_REMOTE_341",
|
|
347
|
+ "peekOfCode": "\t\tlargest = r\n\t# If necessary, this changes root by swapping va-\n\t# lues\n\t\tlista[i], lista[largest] = lista[largest], lista[i]\n\t\t# This heapifies the root repeatedly\n\t\theapify(lista, n, largest)",
|
|
348
|
+ "detail": "heap_REMOTE_341",
|
|
349
|
+ "documentation": {}
|
|
350
|
+ },
|
|
351
|
+ {
|
91
|
352
|
"label": "merge",
|
92
|
353
|
"kind": 2,
|
93
|
354
|
"importPath": "merge",
|
|
@@ -218,7 +479,7 @@
|
218
|
479
|
"kind": 2,
|
219
|
480
|
"importPath": "sorting",
|
220
|
481
|
"description": "sorting",
|
221
|
|
- "peekOfCode": "def mergeSort(lista, l, r):\n\tif l < r:\n # Same as (l+r)//2, but avoids overflow for\n # large l and h\n\t\tm = l+(r-l)//2\n # Sort first and second halves\n\t\tmergeSort(lista, l, m)\n\t\tmergeSort(lista, m+1, r)\n\t\tmerge(lista, l, m, r)\n''' Luis Andrés López Mañán",
|
|
482
|
+ "peekOfCode": "def mergeSort(lista, l, r):\n<<<<<<< HEAD\n\tif l < r:\n # Same as (l+r)//2, but avoids overflow for\n # large l and h\n\t\tm = l+(r-l)//2\n # Sort first and second halves\n\t\tmergeSort(lista, l, m)\n\t\tmergeSort(lista, m+1, r)\n\t\tmerge(lista, l, m, r)",
|
222
|
483
|
"detail": "sorting",
|
223
|
484
|
"documentation": {}
|
224
|
485
|
},
|
|
@@ -263,7 +524,7 @@
|
263
|
524
|
"kind": 5,
|
264
|
525
|
"importPath": "sorting",
|
265
|
526
|
"description": "sorting",
|
266
|
|
- "peekOfCode": "\tn = len(lista)\n\theap.heapify(lista,n,0)\n\t''' Se crea un heap máximo y el último padre estará en\n\t\tla posición h1, i.e., la mitad del tamaño de la lista.\n\t\tPor lo tanto, ese sería el comienzo. \n\t'''\n\th1 = (n // 2) - 1\n\tfor i in range(h1, -1, -1):\n\t\theap.heapify(lista, n, i)\n\t# Se extrae los elementos uno a uno",
|
|
527
|
+ "peekOfCode": "\tn = len(lista)\n\theap.heapify(lista,n,0)\n\t''' Se crea un heap máximo y el último padre estará en\n\t\tla posición h1, i.e., la mitad del tamaño de la lista.\n\t\tPor lo tanto, ese sería el comienzo. \n\t'''\n\th1 = (n // 2) - 1\n\tfor i in range(h1, -1, -1):\n\t\theap.heapify(lista, n, i)\n<<<<<<< HEAD",
|
267
|
528
|
"detail": "sorting",
|
268
|
529
|
"documentation": {}
|
269
|
530
|
},
|
|
@@ -272,7 +533,16 @@
|
272
|
533
|
"kind": 5,
|
273
|
534
|
"importPath": "sorting",
|
274
|
535
|
"description": "sorting",
|
275
|
|
- "peekOfCode": "\th1 = (n // 2) - 1\n\tfor i in range(h1, -1, -1):\n\t\theap.heapify(lista, n, i)\n\t# Se extrae los elementos uno a uno\n\th2 = n - 1\n\tfor i in range(h2, 0, -1):\n\t\t# Se intercambia, luego se hace heapify\n\t\tlista[i], lista[0] = lista[0], lista[i]\n\t\theap.heapify(lista, 0, i)\n\treturn lista",
|
|
536
|
+ "peekOfCode": "\th1 = (n // 2) - 1\n\tfor i in range(h1, -1, -1):\n\t\theap.heapify(lista, n, i)\n<<<<<<< HEAD\n\t# Se extrae los elementos uno a uno\n\th2 = n - 1\n\tfor i in range(h2, 0, -1):\n\t\t# Se intercambia, luego se hace heapify\n\t\tlista[i], lista[0] = lista[0], lista[i]\n\t\theap.heapify(lista, 0, i)",
|
|
537
|
+ "detail": "sorting",
|
|
538
|
+ "documentation": {}
|
|
539
|
+ },
|
|
540
|
+ {
|
|
541
|
+ "label": "\th2",
|
|
542
|
+ "kind": 5,
|
|
543
|
+ "importPath": "sorting",
|
|
544
|
+ "description": "sorting",
|
|
545
|
+ "peekOfCode": "\th2 = n - 1\n\tfor i in range(h2, 0, -1):\n\t\t# Se intercambia, luego se hace heapify\n\t\tlista[i], lista[0] = lista[0], lista[i]\n\t\theap.heapify(lista, 0, i)\n=======\n\th2 = n - 1\n\tfor i in range(h2, 0, -1):\n\t\tlista[i], lista[0] = lista[0], lista[i]\n\t\theap.heapify(lista, 0, i)",
|
276
|
546
|
"detail": "sorting",
|
277
|
547
|
"documentation": {}
|
278
|
548
|
},
|
|
@@ -281,7 +551,7 @@
|
281
|
551
|
"kind": 5,
|
282
|
552
|
"importPath": "sorting",
|
283
|
553
|
"description": "sorting",
|
284
|
|
- "peekOfCode": "\th2 = n - 1\n\tfor i in range(h2, 0, -1):\n\t\t# Se intercambia, luego se hace heapify\n\t\tlista[i], lista[0] = lista[0], lista[i]\n\t\theap.heapify(lista, 0, i)\n\treturn lista\ndef quickSort(lista):\n\t# definan el algoritmo de ordenamiento quicksort\n\telements = len(lista)\n # Base case",
|
|
554
|
+ "peekOfCode": "\th2 = n - 1\n\tfor i in range(h2, 0, -1):\n\t\tlista[i], lista[0] = lista[0], lista[i]\n\t\theap.heapify(lista, 0, i)\n>>>>>>> sortingHeap\n\treturn lista\ndef quickSort(lista):\n\t# definan el algoritmo de ordenamiento quicksort\n\telements = len(lista)\n # Base case",
|
285
|
555
|
"detail": "sorting",
|
286
|
556
|
"documentation": {}
|
287
|
557
|
},
|