Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I can provide more information if needed. Problem 7.13. The use of sentinels in algorithm merge requires the availability of an additional cell in the
I can provide more information if needed.
Problem 7.13. The use of sentinels in algorithm merge requires the availability of an additional cell in the arrays to be merged; see Section 7.4.1. Although this is not an issue when merge is used within mergesort, it can be a nuisance in other applications. More importantly, our merging algorithm can fail if it is not possible to guarantee that the sentinels are strictly greater than any possible value in the arrays to be merged. (a) Give an example of arrays U and v that are sorted but where the result of merge (U,V,T) is not what it should be. What is the contents of T after this pathological call? You are allowed the value co in arrays U and V and you may wish to specify the values of U and V outside the bounds of the arrays.) (b) Give a procedure for merging that does not use sentinels. Your algorithm must work correctly in linear time provided the arrays U and V are sorted prior to the callStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started