| Issue 11: | Error in removing the first element from the binary heap | |
| 1 person starred this issue and may be notified of changes. | Back to list |
Implemented a binary heap and it passed initial unit tests; however, I'm getting an error when I now try to run acceptance tests...
Traceback (most recent call last):
File "RunPFD.py", line 13, in <module>
pfd_solve(sys.stdin, sys.stdout)
File "D:\My Documents\Dropbox\School Stuff\CS 373\workspace\PFD\PFD.py", line 179, in pfd_solve
s = pfd_sort(a, vertices)
File "D:\My Documents\Dropbox\School Stuff\CS 373\workspace\PFD\PFD.py", line 78, in pfd_sort
binHeapRemoveFirst(noDependencies)
File "D:\My Documents\Dropbox\School Stuff\CS 373\workspace\PFD\PFD.py", line 139, in binHeapRemoveFirst
if binHeap[child1] > binHeap[index] :
IndexError: list index out of range
Feb 14, 2012
Project Member
#1
J.Wes.Pickens
Feb 14, 2012
(No comment was entered for this change.)
Summary:
Error in removing the first element from the binary heap
Feb 14, 2012
The case where the element has no children should be handled the same as if it had reached the last element in the heap. The special case to be addressed is when the element has only one child.
Feb 14, 2012
Added code to address the special cases. Able to run acceptance tests without compilation errors.
Status:
Fixed
|