PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [Cs223] Merging deques
Date: Friday, 20 Mar 2020, 19:41:20


    > Message Posted By: Unknown
    >
    > Right now I am trying to implement a version of quickSort that generates
    > two new deques per recursive call as a starting point.
    >
    > However, once I have generated the deques at each call, how am I supposed
    > to merge them once my sorting has ended so that I can print out the
    > results? I am guessing that some sort of function that merges the numerous
    > deques will be necessary? How can I go about doing that?

The elements in one queue are greater than the splitter,
those in the other are less than (assuming that all are
unique).  After each queue is sorted in place, you can
easily copy the elements back to the original queue in
the correct order.

--Stan-
PREV INDEX NEXT