I have this algorithm, and I am trying to calculate its complexity.
A = {{B_1}, {B_2}, {B_3}, ..., {B_n}}
t_n = 0 //for every set in A
while A != empty
Calculate f(t_n) for each element in A using t_n.
n' = argmin(A) //n' is the element (set) in A with smallest f(t_n)
t_n' = t_n' + 1
if (t_n' == Constant)
B_n' = B_n' - {k} //k is an element in B_n'
if(B_n' == empty)
A = A - {B_n'}
A
is a set, and if the condition (t_n' == Constant)
and if(B_n' == empty)
are true, we remove an element (set) from the set A
until A
is empty. Assume calculating f(t_n)
takes a constant time.
If every element (set) in A
has the same size, can we say that the complexity is O(|A|*|B_n|)
? How about if elements (sets) in A
have different sizes?