-
Notifications
You must be signed in to change notification settings - Fork 28
Description
like so:
void Heapify(List<PointData> list, int i) { Profiler.BeginSample("heap i fy"); var parent = (i - 1) / 2; while (parent >= 0 && list[i].FScore < list[parent].FScore) { (list[i], list[parent]) = (list[parent], list[i]); i = parent; parent = (i - 1) / 2; } Profiler.EndSample(); }
void HeapifyDeletion(List<PointData> list, int i) { Profiler.BeginSample("heapify deletion"); int smallest; int l; int r; while (true) { smallest = i; l = 2 * i + 1; r = 2 * i + 2; if (l < list.Count && list[l].FScore < list[smallest].FScore) { smallest = l; } if (r < list.Count && list[r].FScore < list[smallest].FScore) { smallest = r; } if (smallest == i) { break; } (list[i], list[smallest]) = (list[smallest], list[i]); i = smallest; } Profiler.EndSample(); }