Hostel Visit using vectors

Sir, can not we use vectors for solving the hostel visit problem instead of using priority queue ?

We will take vectors for storing distance and then we will sort it by using sort() function. vectors will allow us to access the elements directly which we can not do in priority queue.

hello @Shamikh07
it will not be efficient becuase with query vector will change
and hence we will need to sort the vector again n again which is not efficient at all