Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
左偏树应用先把每个值单独开一个堆,将第一个入栈,从第二个开始,让当前项入栈,让栈顶跟第二项比,若小于第二项,即两项合并成新的区域,再入栈。要注意,每个区域的堆里初始都是1=(1+1)/2个数,假设两个要合并的区域总有A、B个数,则堆里总有(A+1)/2、(B+1)/2个数,若(A+1)/2+(B+1)/2>(A+B+1)/2,仅需把合并好的堆弹出顶端即可。 Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator