Пример #1
0
void InsertHeap::sort(vector<int> & array)
{
	vector<int> temp;
	HeapTree *tree = new HeapTree(temp);

	for (int i = 0; i < (int)array.size(); ++i)
	{
		tree->insert(array[i]);
	}

	for (int i = array.size()-1; i >= 0; --i)
	{
		array[i] = tree->remove();
	}

	tree->print();

	delete tree;
}
Пример #2
0
int main(void){
	HeapTree<int> Struct;
	Struct.add(3);
	cout << (int)Struct.remove(NULL);
	return 0;
}