Questions tagged [rank]

6 questions
4
votes
1 answer

Improving a ranking system with "best rank"

I've implemented a ranking system (based on a score), using a Map and an improved BST>. So now I can compute "rank of a player" in O(log(n)) time, "top xxx players", insert/update/remove in O(log(n)) time. Now I want…
Nisalon
  • 143
  • 3
1
vote
0 answers

What is the worst case time complexity of unranking n choose k combinations (combinatorial number system, combinadics)

The combinatorial number system shows that there is a bijection between the natural numbers less than $n \choose k$ and $n\choose k$ combinations. There is a greedy algorithm for unranking combinations, which one may calculate the worst-case run…
1
vote
1 answer

Find a key in a BBST for which sum of values of keys smaller then it - is maximal

I'm required to describe an implementation of a data structure that holds key,value pairs, which can be signed integers. We need to be able to init() in O(1), insert(x) in O(logn), delete(x) in O(logn) and sumPrevious(x), which returns sum of values…
sadcat_1
  • 193
  • 1
  • 7
1
vote
1 answer

Rank of a graph in matroid theory

I was going through the concept of graphs as matroids and I came upon the rank of a graph. Wikipedia lists it as $n - c$, $n = |V|$, $c =$ # of connected components. I do understand rank and nullity of matrices, and graphs when expressed in their…
1
vote
1 answer

Why merge into the larger tree in union by rank

When we do union by rank we merge the smaller tree into the larger tree. I dont understand why we do this exactly?
Trajan
  • 143
  • 5
0
votes
2 answers

How can I get index of combination from element indices

An array of combinations is generated from two arrays, indices: 0 1 2 3 4 5 array 1: [a, b] array 2: [A, B, C] repeating array 1: a, b, a, b, a, b repeating array…
Jin Kwon
  • 103
  • 4