![](https://csdnimg.cn/release/download_crawler_static/72563221/bg7.jpg)
n n/2 n/2
n(n-1)/2
2
T T T
T
T
T
T
P K P
K T PK
i j
4 j P j T P(j)<T P(j)
P(i)
5 i P i T P(i)>T P(i)
P(j)
i j i=j P(i)
1
j-1 j
j T j-1
T T
T T j
j
n(n-1)/2
2
H H
1 h=n/2k(k=1,2, [log2n], n