I think that this problem is also solved with help of proirity queue but why i am unamble to swap top element of priority queue and element of array
i get error message invalid types ‘int[int]’ for array subscript
I think that this problem is also solved with help of proirity queue but why i am unamble to swap top element of priority queue and element of array
i get error message invalid types ‘int[int]’ for array subscript
@Ankit_kumar_3003,
You cannot use swap function like that, rather save the top element in a temporary variable, and then swap array element with temporary variable, and insert in priority_queue the temporary variable.
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.