NanoApe's Blog

既是咸鱼又是辣鸡

【STL】Heap

NanoApe posted @ 2016年5月16日 13:41 in 蒟蒻不撕烤智熵何来 , 298 阅读

 

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);

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter