【STL】Heap
NanoApe
posted @ 2016年5月16日 13:41
in 蒟蒻不撕烤智熵何来
, 1170 阅读
Heap
#include <algorithm> void make_heap(first_pointer,end_pointer,compare_function); void push_heap(first_pointer,end_pointer,compare_function); void pop_heap(first_pointer,end_pointer,compare_function); void sort_heap(first_pointer,end_pointer,compare_function); make_heap(a+1, a+1+n, cmp); a[++n]=val; push_heap(a+1, a+1+n, cmp); pop_heap(a+1, a+1+n, cmp); a[n--]=0; sort_heap(a+1, a+1+n, cmp);