can i make pq of subarray by just writting this.
priority_queue pq(arr,arr+2);
can i make pq of subarray by just writting this.
priority_queue pq(arr,arr+2);
yes you can do this
i hope this helps
if yes hit a like and don’t forgot to mark doubt as resolved
if you have more doubts regarding this feel free to ask
can you please check this code.
in case of array arr is a pointer to array
so when you write
priority_queue<int, vector ,greater > ps(arr,arr+n); this is correct
but in case of vector< int>v
here v is not the address so it gives errror