- #1
evinda
Gold Member
MHB
- 3,836
- 0
Hi! (Happy)
Suppose that we have this tournament tree and we want to find the second smallest element.View attachment 3840Suppose that $d_2<d_1$. Then we know that the smallest element is $d_2$.
Then we will know that the smallest element of the left subtree is $d_1$ and it suffices to find the smallest element of the right subtree in order to compare them, right?
If we suppose that $c_3=b_6=a_{11}=d_2$ then we have to compare $a_{12} $ with $b_5$, the smallest of them with $c_4$ and finally the smallest of these two elements which we considered at last with $d_1$. The smallest of them will be the second smallest element, right? (Thinking)
Suppose that we have this tournament tree and we want to find the second smallest element.View attachment 3840Suppose that $d_2<d_1$. Then we know that the smallest element is $d_2$.
Then we will know that the smallest element of the left subtree is $d_1$ and it suffices to find the smallest element of the right subtree in order to compare them, right?
If we suppose that $c_3=b_6=a_{11}=d_2$ then we have to compare $a_{12} $ with $b_5$, the smallest of them with $c_4$ and finally the smallest of these two elements which we considered at last with $d_1$. The smallest of them will be the second smallest element, right? (Thinking)