Jump to content
Posted 04 December 2012 - 08:13 AM
Posted 04 December 2012 - 08:28 AM
“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”
Posted 04 December 2012 - 08:45 AM
I gets all your texture budgets!
Posted 04 December 2012 - 03:46 PM
I second this. Split array into two, spawn two threads and each handle its own segment. Recursively do this until you reach the smallest subset.
Look up merge sort - it inherently merges two sorted lists together, you'll find how to do it there. The result is basically a simplified selection sort, taking advantage of the fact that the two lists are already sorted, which runs in O(n) time and uses a temporary array. You could extend this to an arbitrary number of lists, or you could do the merging in parallel too (which would be more useful, because doing the merge step on a single thread defeats your use of multithreading in the sorting step).
Is this for a school assignment, by the way? If not, you might be better served by trying to implement a multithreaded merge sort, which is more interesting and is actually useful.
Posted 18 December 2012 - 09:49 PM
Edited by Shannon Barber, 18 December 2012 - 09:50 PM.
Posted 19 December 2012 - 07:00 AM
Edited by samoth, 19 December 2012 - 07:03 AM.