You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to test the algorithm with some different numbers, I faced the "AttributeError: 'NoneType' object has no attribute 'data'". basically, when you have many same key nodes, this error happens. Do you maybe know why this is happening? (It removes the node from child list other than the rootlist.)
f = FibonacciHeap()
seed(4333)
# insert elements
for i in xrange(0, 1000): #tried to do for 1000 nodes
f.insert(randint(1,500)) #random number between 1-500
# print the root list
print [x.data for x in f.iterate(f.root_list)]
# extract min
while f.total_nodes > 0:
m = f.extract_min()
print 'min is: ' + str(m.data)
The text was updated successfully, but these errors were encountered:
@mshishvan Hi I know it's kind of late to say this, but I found out the bug comes out because min_node can points to a child node not in the rootlist after consolidate when have several nodes with same key. Change "if A[i].key < self.min_node.key:" to "if A[i].key <= self.min_node.key:" in the consolidate function will solve this.
Hi Daniel,
I tried to test the algorithm with some different numbers, I faced the "AttributeError: 'NoneType' object has no attribute 'data'". basically, when you have many same key nodes, this error happens. Do you maybe know why this is happening? (It removes the node from child list other than the rootlist.)
https://repl.it/Bouq/13
The text was updated successfully, but these errors were encountered: