Average case analysis of a set family

33 Views Asked by At

I am a computer science student who is currently doing research work. I have a case with some family of sets $\mathscr{A}$, which contains $n$ number of sets and each set contains $m$ number of elements. All sets in $\mathscr{A}$ get traverse in linear order. I have to provide the best, the average and the worst cases analysis in form of analytical model.

The set hierarchy is$$ \mathscr{A} = \{\{a_{11}, a_{12}, a_{13}, \cdots, a_{1m}\},\ \{a_{21}, a_{22}, a_{23}, \cdots, a_{2m}\},\\ \{a_{31}, a_{32}, a_{33}, \cdots, a_{3m}\},\ \cdots,\ \{a_{n1}, a_{n2}, a_{n3}, \cdots, a_{nm}\}\}. $$ The best and the worst case are simple, but I am not sure about the average case. I have calculated average case like this:$$\require{cancel} \frac{\dfrac{1\cancel{m}(1m + 1)}{2}}{1\cancel{m}} \Longrightarrow \frac{1m + 1}{2}. $$ By doing that to all,\begin{align*} &\mathrel{\phantom{=}}{} \frac{1m + 1}{2} + \frac{2m + 1}{2} + \frac{3m + 1}{2} + \cdots + \frac{nm + 1}{2}\\ &= \frac{1}{2} \bigl( (1m + 1) + (2m + 1) + (3m + 1) + \cdots + (nm + 1) \bigr)\\ &= \frac{1}{2} \left( \frac{\dfrac{\cancel{(nm + 1)}(nm + 1 + 1)}{2}}{\cancel{nm + 1}} \right) = \frac{1}{2} \left( \frac{nm + 2}{2} \right) = \frac{1}{2} \left( \frac{nm}{2} \right) = \frac{nm}{4}. \end{align*} Is it correct to do it like this?