Q:

what is the use of sentinels in merge sort

The use of sentinels in merge sort prevents us from needing to check to see if we have reached the end of either of the arrays being sorted. Merge sort can be performed without a sentinel, but an implementation of merge sort without a sentinel adds an additional check for every iteration of the comparison loop.
0

New to Communities?

Join the community