Algorithm
-
힙정렬 예시 ( c,c++ push pop update erase 다 들어있는 거 )Algorithm 2022. 2. 28. 02:51
힙정렬은 생각보다 안어려움 아래 코드를 디버깅하면서 이해하면 됨 struct node { int mSection; int mid; int readcount; int erase; }nodes[50001]; #define swap(a, b) {int t = a; a = b; b = t;} struct Heap { int heap[10000]; int hn; int pos[10000]; void swapAll(int x, int y) { swap(heap[x], heap[y]); swap(pos[heap[x]], pos[heap[y]]); } int Amax(int mid1, int mid2) { return 1; // 입맛에 맞게 조건 넣기 } void up(int c) { for (register int ..