Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/gsomix/shogun
Browse files Browse the repository at this point in the history
  • Loading branch information
lisitsyn committed Jul 26, 2011
2 parents e0df385 + f8fba71 commit 0370104
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/shogun/lib/FibonacciHeap.cpp
Expand Up @@ -51,24 +51,24 @@ CFibonacciHeap::~CFibonacciHeap()
delete [] nodes;
}

void CFibonacciHeap::insert(int32_t idx, float64_t key)
void CFibonacciHeap::insert(int32_t index, float64_t key)
{
if(idx > max_num_nodes || idx < 0)
if(index >= max_num_nodes || index < 0)
return;

if(nodes[idx]->index != -1)
if(nodes[index]->index != -1)
return; // node is not empty

// init "new" node in array
nodes[idx]->child = NULL;
nodes[idx]->parent = NULL;
nodes[index]->child = NULL;
nodes[index]->parent = NULL;

nodes[idx]->rank = 0;
nodes[idx]->index = idx;
nodes[idx]->key = key;
nodes[idx]->marked = false;
nodes[index]->rank = 0;
nodes[index]->index = index;
nodes[index]->key = key;
nodes[index]->marked = false;

add_to_roots(nodes[idx]);
add_to_roots(nodes[index]);
num_nodes++;
}

Expand Down Expand Up @@ -151,7 +151,7 @@ void CFibonacciHeap::clear()

int32_t CFibonacciHeap::get_key(int32_t index, float64_t &ret_key)
{
if(index > max_num_nodes || index < 0)
if(index >= max_num_nodes || index < 0)
return -1;
if(nodes[index]->index == -1)
return -1;
Expand All @@ -166,7 +166,7 @@ void CFibonacciHeap::decrease_key(int32_t index, float64_t key)
{
FibonacciHeapNode* parent;

if(index > max_num_nodes || index < 0)
if(index >= max_num_nodes || index < 0)
return;
if(nodes[index]->index == -1)
return; // node is empty
Expand Down

0 comments on commit 0370104

Please sign in to comment.