public string RadixSort(int[] arr)
        {
            int max = int.MinValue;

            for (int i = 0; i < arr.Length; i++)
            {
                if (max < arr[i])
                {
                    max = arr[i];
                }
            }
            RadixNode[] hashTable = new RadixNode[10];
            int         j         = 1;

            while (max > 0)
            {
                for (int i = 0; i < arr.Length; i++)
                {
                    int       d = (arr[i] / j) % 10;
                    RadixNode t = new RadixNode(arr[i], hashTable[d]);
                    hashTable[d] = (hashTable[d] != null) ? hashTable[d] : t;
                }
                j   *= 10;
                max /= 10;
                for (int i = 0, k = 0; i < hashTable.Length; i++)
                {
                    while (hashTable[i] != null)
                    {
                        arr[k++]     = hashTable[i].data;
                        hashTable[i] = hashTable[i].next;
                    }
                }
            }
            return(Display(arr));
        }
 public RadixNode(int data, RadixNode root)
 {
     this.data = data;
     if (root != null)
     {
         if (root.next == null && root.previous == null)
         {
             root.next = root.previous = this; this.previous = root;
         }
         else
         {
             this.previous = root.previous;
             root.previous = root.previous.next = this;
         }
     }
 }