normally never ask school exercise on stackoverflow think want impossible without using temporary array or modifying array.
what want is:
quicksort function should recursive
it should sort(that sorting algorithms lol) should leave array intact,
may not use temporary array
and has return sorted list in linkedlist format.
function should this:
linkedlist *quicksort(int *array, int startposition, int endposition)
returning linkedlist easy, sorting easy without modyfying in everystep of algorithm? dont think so.
i not saying please send me solution. want answer this, not impossible?
edit: "leaving array intact" teacher meant "dont change size of array, can modify order of array", problem solved
i check 1 of answers make tag question solved.
to answer question directly: quick sort can done in place (without temporary storage areas.)
since don't want complete homework directly :) here resource going.
see second algorithm @ http://rosettacode.org/wiki/sorting_algorithms/quicksort
Comments
Post a Comment