Question: ( 3 points ) A randomized linked list sorting algorithm works as follows. We want to build a linked list in which the keys are
points A randomized linked list sorting algorithm works as follows. We want to build a linked list in which the keys are in increasing order. That is every node has a smaller key than its successor in the list. For ease of discussion we assume that the keys are distinct integers from to The algorithm randomly picks a key from the remaining keys, and inserts it into the list. This process repeats until all keys are inserted. The inserted key will skip those at the beginning of the list that are smaller than it and will stop at the first key that are greater than it We then insert the key before To ensure that all keys will stop we assume that initially the list has only one key, After we insert all keys ye will have a sorted linked list from to
Every inserted key will stop exactly once.
The smallest key will not skip any keys.
The largest key will always skip keys.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
