コード例 #1
0
ファイル: timer.c プロジェクト: zhaodongxing/turnix
static void heap_adjust(size_t i)
{
	assert(i < timer_context.n);

	if (i > 0) {
		size_t p = (i - 1) / 2;

		if (time_after(timer_context.heap[p]->expires,
			       timer_context.heap[i]->expires)) {
			heap_pull_up(i);
			return;
		}
	}
	heap_push_down(i);
}
コード例 #2
0
ファイル: sort.c プロジェクト: MaheshReddy/PractiseCode
void heap_delete(struct heap* heap,int pos){
	heap->heap_arr[pos]=heap->heap_arr[heap->heap_cursize--];
	heap_push_down(heap,pos);
}