Exemplo n.º 1
0
 public static void Print(PlatesContainer plates)
 {
     for (int i = 0; i < plates.Size; i++)
     {
         Console.WriteLine(plates.Take(i).Letters + " " + plates.Take(i).Number);
     }
 }
Exemplo n.º 2
0
        public static void AddIntToArray(PlatesContainer items, int[] array)
        {
            NumberPlate plate;

            for (int i = 0; i < items.Size; i++)
            {
                plate    = items.Take(i);
                array[i] = plate.GetPlateCode();
            }
        }
Exemplo n.º 3
0
        public static void Test_Array_Radix_Sort(int amount)
        {
            PlatesContainer container = new PlatesContainer(amount);

            DoContainer(container);

            var watch = System.Diagnostics.Stopwatch.StartNew();

            Radix_sort(container);
            watch.Stop();
            Console.WriteLine(string.Format("{0, -10} {1, -10}", amount, watch.Elapsed));
        }
Exemplo n.º 4
0
        public static PlatesContainer DoContainer(PlatesContainer plates)
        {
            NumberPlate plate;

            for (int i = 0; i < plates.Size; i++)
            {
                plate = new NumberPlate();
                plate.Generator();
                plates.AddPlate(plate);
            }
            return(plates);
        }
Exemplo n.º 5
0
        public static void Radix_sort(PlatesContainer items)
        {
            int[] arr = new int[items.Count];
            AddIntToArray(items, arr);
            for (int exp = 1; exp < Math.Pow(10, 9); exp *= 10)
            {
                Counting_sort(arr, exp);
            }

            string      plates;
            NumberPlate plate;

            for (int i = 0; i < items.Size; i++)
            {
                plate  = new NumberPlate();
                plates = BackToPlate(plate, arr[i]);
                items.Set(plate, i);
            }
        }