i can not make out what you have done in the line number 7 of your code
why there we had use vector
How priority queues have been intialised
@Bhavit_Singla
The algorithm we used to solve this problem was that we would first put all the elements of the array we got as input.
Now note that we have stored the input in a vector instead of array and we passed this vector as an argument. What you were supposed to do here was to push all the elements of the vector into the PQ. To do this , you can iterate over the entire vector and push the elements one by one into the PQ. Or alternatively , you could do this in one statement using a constructor of PQ , that takes as argument the starting and ending point of array/vector and directly pushes all its elements into the PQ. So we used that.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.