Created
July 13, 2018 17:37
-
-
Save onkar27/87666d2d4929bb925bbb5e225987d4b7 to your computer and use it in GitHub Desktop.
Heaps using C++ STL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// max heap | |
priority_queue <ll> max_heap; // by defualt priority_queue is maxheap always. | |
// min heap | |
priority_queue <ll, vector<ll>, greater<ll> > min_heap; | |
// type, container, comparator function | |
typedef struct mystruct { | |
ll one; | |
ll two; | |
bool operator < (const mystruct t) const { | |
one < t.one; | |
} | |
}mystruct; | |
priority_queue <mystruct> heapofStruct; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment