Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int CalculateAmount(int score1, int score2)
- {
- return LookForScoreRight(score2, root) - LookForScoreLeft(score1, root);
- }
- public int LookForScoreLeft(int score, Gamer gLeaf)
- {
- if (score > gLeaf.gScore)
- {
- if (gLeaf.right != null)
- return LookForScoreLeft(score, gLeaf.right);
- else
- {
- return FindNormalRank(gLeaf);
- }
- }
- else
- {
- if (gLeaf.left != null)
- return LookForScoreLeft(score, gLeaf.left);
- else
- {
- //if (gLeaf.parent.right==gLeaf)
- // return FindNormalRank(gLeaf.parent);
- //else
- return FindNormalRank(gLeaf)-1;
- }
- }
- }
- public int LookForScoreRight(int score, Gamer gLeaf)
- {
- if (score < gLeaf.gScore)
- {
- if (gLeaf.left != null)
- return LookForScoreRight(score, gLeaf.left);
- else
- {
- return FindNormalRank(gLeaf) - 1;
- }
- }
- else
- {
- if (gLeaf.right != null)
- return LookForScoreRight(score, gLeaf.right);
- else
- return FindNormalRank(gLeaf);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement