void PaperForReview::setNewReviewer(int newScore, int newReviewer)
{
	for(int i=0; i< numOfReqReviewrs; i++)
	{
		if(reviewerBids[i].score == minScore)
		{
			reviewerBids[i].score = newScore;
			reviewerBids[i].reviewerID =  newReviewer;
            findMinScore();
		}
	}
}
Ejemplo n.º 2
0
ScoreTreeNode deleteScoreTreeNode(ScoreTreeNode tree, ScoreTreeNode node)
{
	if(!(node->head == NULL && node->tail == NULL))
	{
		printf("Error: tried to free ScoreTreeNode that still has items in its list\n");
		exit(1);
	}
	if(tree == NULL)
	{
		printf("Error: can't find ScoreTreeNode to delete\n");
		exit(1);
	}
	ScoreTreeNode TmpCell;
	if(node->score < tree->score)
	{
		tree->left = deleteScoreTreeNode(tree->left, node);
	}
	else if(node->score > tree->score)
	{
		tree->right = deleteScoreTreeNode(tree->right, node);
	}
	else if(tree->left && tree->right)
	{
		int tmpscore;
		TmpCell = findMinScore(tree->right);
		tree->head = TmpCell->head;
		tree->tail = TmpCell->tail;
		tmpscore = tree->score;
		tree->score = TmpCell->score;
		TmpCell->score = tmpscore;
		TmpCell->head = NULL;
		TmpCell->tail = NULL;
		tree->right = deleteScoreTreeNode(tree->right, TmpCell);
	}
	else
	{
		TmpCell = tree;
		if(tree->left == NULL)
		{
			tree = tree->right;
		}
		else if(tree->right == NULL)
		{
			tree = tree->left;
		}
		free(TmpCell);
		app_stats.pools -= 1;
	}

	return tree;
}