Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

priority queue with min heap

This is frequently used in Competitive Programming.
We first multiply all elements with (-1). Then we create a max heap (max heap is the default for priority queue). 
When we access the data and want to print it we simply multiply those elements with (-1) again.
Source by softwareengineering.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #priority #queue #min #heap
ADD COMMENT
Topic
Name
4+6 =