int main(int argc, char* argv[]) { int T, N; scanf("%d", &T); for (int test_case = 1; test_case <= T; test_case++) { scanf("%d", &N); heapInit(); for (int i = 0; i < N; i++) { int value; scanf("%d", &value); heapPush(value); } printf("#%d ", test_case); for (int i = 0; i < N; i++) { int value; heapPop(&value); printf("%d ", value); } printf("\n"); } return 0; }
int main() { int i,n,x; heap *p=NULL; p=heapAlloc(); scanf("%d",&n); heapInit(p,sizeof(int),n+1,gt); for(i=0;i<n/2;i++) { x=i+n/2; heapPush(p,&x); } for(i=0;i<n/2;i++) heapPush(p,&i); while(!heapEmpty(p)) { heapPop(p,&x); printf("%d%c",x,heapEmpty(p)?'\n':' '); } return 0; }