In C++ STL, there is priority_queue that can directly be used to implement Max Heap. See below example. Output : 30 20 10 5 1 Since elements are printed in descending order, we have a max heap by default. How to implement Min Heap? priority_queue supports a constructor that requires two extra arguments to… Read More »
See Placement Course for placement preparation, GATE Corner for GATE CS Preparation and Quiz Corner for all Quizzes on GeeksQuiz.