In the video, it said that it takes start and end as of the array as a parameter, but then we used a and a + n. But a is the array,. So I didn’t get why we used a and a+n.
Parameter of sort function
Yeah we have to give the start and end as parameter but I think you interpreted this wrong.
have you ever sorted a vector?
we sort it like this:
vector<int> v={1,4,6,3,2,9,7}
sort(v.begin(),v.end());
Now,
what we do here, we give pointers (as v.begin() and v.end() are pointers) to this sort function which will tell me about its starting and ending.
I haven’t gave its index. So therefore we give a (which is pointing to the start of the array) and a+n ( which is pointing at the end).
I think I cleared your doubt. If it is not cleared yet, you can reopen this again.
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.