Demo entry 5191657

qq

   

Submitted by anonymous on Jun 08, 2016 at 17:51
Language: C++. Code size: 210 Bytes.

void HeapInsert( int* a, int n , int x)
{
	a[j] = a[j-1];
	for (int i = 1; i < n; ++i)
	{
		int tmp = a[i];
		for (int j = i; j > 0 && tmp < a[j-1]; --j)
		{
			a[j] = a[j-1];
		}
		a[j] = tmp;
	}
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).