Ocronet.Dynamic.OcroFST.Heap.heapify_up C# (CSharp) Method

heapify_up() private method

Fix the heap invariant broken by decreasing the cost of heap node i.
private heapify_up ( int i ) : void
i int
return void
        private void heapify_up(int i)
        {
            while (i > 0)
            {
                int j = parent(i);
                if (costs[i] < costs[j])
                {
                    heapswap(i, j);
                    i = j;
                }
                else
                {
                    return;
                }
            }
        }