Horje
heap c++ stl Code Example
heap c++ stl
#include<bits/stdc++.h>
using namespace std;
int main()
{
	vector<int> v1 = {20, 30, 40, 25, 15};
	make_heap(v1.begin(), v1.end());
	cout << "The maximum element of heap is : ";
	cout << v1.front() << endl;
	v1.push_back(50);
	push_heap(v1.begin(), v1.end());
	cout << "The maximum element of heap after push is : ";
	cout << v1.front() << endl;
	pop_heap(v1.begin(), v1.end());
	v1.pop_back();
	cout << "The maximum element of heap after pop is : ";
	cout << v1.front() << endl;
	
	return 0;
}




Cpp

Related
c++ split string by several space Code Example c++ split string by several space Code Example
run cmd command c++ Code Example run cmd command c++ Code Example
c++ vector element search Code Example c++ vector element search Code Example
c++ builder Code Example c++ builder Code Example
print each number of digit c++ Code Example print each number of digit c++ Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10