Compilation issues!

please debug my code.
link to my code - https://ide.codingblocks.com/s/251484

Whenever you use custom type(class) in priority_queue you have explicitly write the compare function for it!!
But here why do you need info like array index etc!, just implement it normally as integer.


see this

i am passing comparator expilicity , still code is not running. please find out what conditions i am missing. link to my code - https://ide.codingblocks.com/s/251484

why have you done operator overloading. can’t we just make our comparator fuction and pass it as an argument like we pass in sort function tom sort arrays…sort(arr,arr+n,mycompare).

Yes but in sort function!! we write comparators in struct/class when passing to STL containers