Use CODE Tags when posting code.
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
>>Are my answers correct?
Not quite. Without giving anything away..
a)
Think a bit more about what happens at "step 4: fix(q1, 2-1)". This is a recursive call (a function calling itself again, usually with different parameters, in this case, n-1 instead of n).
b)
Already, with your current answer to (a), your answer to (b) is incorrect. Once you have worked out the correct answer to (a), this should be pretty easy to answer.
c)
A precondition for fix() is: The queue exists, it is not empty, and... it has at least (blank) elements.
mike_2000_17
Posting Virtuoso
2,134 posts since Jul 2010
Reputation Points: 1,634
Solved Threads: 457