-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathchallenge.html
More file actions
34 lines (29 loc) · 1.2 KB
/
challenge.html
File metadata and controls
34 lines (29 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<p>
Implement a radix sort algorithm that sorts an array of 32-bit unsigned integers on a GPU.
The program should take an input array of unsigned integers and sort them in ascending order using the radix sort algorithm.
The <code>input</code> parameter contains the unsorted array, and the sorted result should be stored in the <code>output</code> array.
</p>
<h2>Implementation Requirements</h2>
<ul>
<li>External libraries are not permitted</li>
<li>The <code>solve</code> function signature must remain unchanged</li>
<li>The final sorted result must be stored in the <code>output</code> array</li>
<li>Use radix sort algorithm (not other sorting algorithms)</li>
<li>Sort in ascending order</li>
</ul>
<h2>Example 1:</h2>
<pre>
Input: [170, 45, 75, 90, 2, 802, 24, 66]
Output: [2, 24, 45, 66, 75, 90, 170, 802]
</pre>
<h2>Example 2:</h2>
<pre>
Input: [1, 4, 1, 3, 555, 1000, 2]
Output: [1, 1, 2, 3, 4, 555, 1000]
</pre>
<h2>Constraints</h2>
<ul>
<li><code>1 ≤ N ≤ 100,000,000</code></li>
<li><code>0 ≤ input[i] ≤ 4,294,967,295</code> (32-bit unsigned integers)</li>
<li>Performance is measured with <code>N</code> = 50,000,000</li>
</ul>