* merge two leftist heaps * */LHEAPmerge(LHEAPh1,LHEAPh2){// if one heap is null, return the otherif(h1==NULL)returnh2;if(h2==NULL)returnh1;// if both are not nullif(h1->elementelement){returnmerge1(h1,h2);}else{returnmerge1(h2,h1);}}// h1->element < h2->elementstaticLH...
左偏树(英语: leftist tree或leftist heap), 也可称为左偏堆, 左倾堆, 是计算机科学中的一种树, 是一种优先队列实现方式, 属于可并堆. 左偏堆的合并操作的最坏情況复杂度为O(log n), 而完全二叉堆为O(n), 所以左偏堆适合基于合并操作的情形. 本文图片引自图解数据结构(9)--左偏树 左偏树的结构和...