Search Results

Search found 3 results on 1 pages for 'radixsort'.

Page 1/1 | 1 

  • Is there a good radixsort-implementation for floats in C#

    - by CommuSoft
    I have a datastructure with a field of the float-type. A collection of these structures needs to be sorted by the value of the float. Is there a radix-sort implementation for this. If there isn't, is there a fast way to access the exponent, the sign and the mantissa. Because if you sort the floats first on mantissa, exponent, and on exponent the last time. You sort floats in O(n).

    Read the article

  • Radix sort in java help

    - by endif
    Hi i need some help to improve my code. I am trying to use Radixsort to sort array of 10 numbers (for example) in increasing order. When i run the program with array of size 10 and put 10 random int numbers in like 70 309 450 279 799 192 586 609 54 657 i get this out: 450 309 192 279 54 192 586 657 54 609 Don´t see where my error is in the code. class IntQueue { static class Hlekkur { int tala; Hlekkur naest; } Hlekkur fyrsti; Hlekkur sidasti; int n; public IntQueue() { fyrsti = sidasti = null; } // First number in queue. public int first() { return fyrsti.tala; } public int get() { int res = fyrsti.tala; n--; if( fyrsti == sidasti ) fyrsti = sidasti = null; else fyrsti = fyrsti.naest; return res; } public void put( int i ) { Hlekkur nyr = new Hlekkur(); n++; nyr.tala = i; if( sidasti==null ) f yrsti = sidasti = nyr; else { sidasti.naest = nyr; sidasti = nyr; } } public int count() { return n; } public static void radixSort(int [] q, int n, int d){ IntQueue [] queue = new IntQueue[n]; for (int k = 0; k < n; k++){ queue[k] = new IntQueue(); } for (int i = d-1; i >=0; i--){ for (int j = 0; j < n; j++){ while(queue[j].count() != 0) { queue[j].get(); } } for (int index = 0; index < n; index++){ // trying to look at one of three digit to sort after. int v=1; int digit = (q[index]/v)%10; v*=10; queue[digit].put(q[index]); } for (int p = 0; p < n; p++){ while(queue[p].count() != 0) { q[p] = (queue[p].get()); } } } } } I am also thinking can I let the function take one queue as an argument and on return that queue is in increasing order? If so how? Please help. Sorry if my english is bad not so good in it. Please let know if you need more details. import java.util.Random; public class RadTest extends IntQueue { public static void main(String[] args) { int [] q = new int[10]; Random r = new Random(); int t = 0; int size = 10; while(t != size) { q[t] = (r.nextInt(1000)); t++; } for(int i = 0; i!= size; i++) { System.out.println(q[i]); } System.out.println("Radad: \n"); radixSort(q,size,3); for(int i = 0; i!= size; i++) { System.out.println(q[i]); } } } Hope this is what you were talking about...

    Read the article

  • NVIDIA CUDA SDK Examples Compilation Unsupported Architecture 'computer_20'

    - by Andrew Bolster
    On compilation of the CUDA SDK, I'm getting a nvcc fatal : Unsupported gpu architecture 'compute_20' My toolkit is 2.3 and on a shared system (i.e cant really upgrade) and the driver version is also 2.3, running on 4 Tesla C1060s If it helps, the problem is being called in radixsort. It appears that a few people online have had this problem but i havent found anywhere that actually gives a solution.

    Read the article

1