Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
pop_heap
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
#include<iostream> #include<vector> #include<algorithm> int main(){ //sample vector std::vector<int> v1 = {2,5,8,7,4,5}; //converting vector into heap make_heap(v1.begin(),v1.end()); //printing first element std::cout << "first element of the heap: " << v1.front() << std::endl; //outputs 8 pop_heap(v1.begin(),v1.end()); //pops the maximum element in the heap //printing frist element std::cout << "first element of the heap after using pop_heap: " << v1.front() << std::endl; return 0; }
g++
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
edit mode
|
history