Exemple #1
0
void RunOperation(char operation, const std::vector<std::string>& arguments,  MinHeap<T>& heap, std::ostream& file)
{
	if(operation == 'I')
	{
		auto value = ToInt(arguments[1]);
		heap.Insert(value);
	}
	else if(operation == 'D')
	{
		auto value = ToInt(arguments[1]);
		heap.Delete(value);
	}
	else if(operation == 'C')
	{
		auto oldValue = ToInt(arguments[1]);
		auto newValue = ToInt(arguments[2]);
		heap.Change(oldValue, newValue);
	}
	else if(operation == 'P')
	{
		heap.PrintPostOrder(file);
		file << std::endl;
	}

}