示例#1
0
 public void Set(NumberPlate plate, int index)
 {
     if (index < Plates.Length)
     {
         Plates[index] = plate;
     }
 }
示例#2
0
        public static LinkedList <NumberPlate> DoList(LinkedList <NumberPlate> plateList, int n)
        {
            NumberPlate plate;

            for (int i = 0; i < n; i++)
            {
                plate = new NumberPlate();
                plate.Generator();
                plateList.InsertNodeAtEnd(plate);
            }
            return(plateList);
        }
示例#3
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);
        }
示例#4
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);
            }
        }
示例#5
0
        // ----------- GENERAL METHODS -------------
        public static string BackToPlate(NumberPlate plate, int number)
        {
            string plateString  = number.ToString();
            string firstLetter  = plateString.Substring(0, 2);
            string secondLetter = plateString.Substring(2, 2);
            string thirdLetter  = plateString.Substring(4, 2);
            string numbers      = plateString.Substring(6, 3);

            char one   = (char)int.Parse(firstLetter);
            char two   = (char)int.Parse(secondLetter);
            char three = (char)int.Parse(thirdLetter);

            string plateLetters = one.ToString() + two.ToString() + three.ToString();
            string plateNumber  = numbers;

            plate.Letters = plateLetters;
            plate.Number  = plateNumber;

            string result = plateLetters + " " + numbers;

            return(result);
        }
示例#6
0
        public static void Radix_sort(LinkedList <NumberPlate> list, int n)
        {
            LinkedList <int>    intList    = new LinkedList <int>();
            LinkedList <string> sortedList = new LinkedList <string>();

            AddIntToLinkedList(list, intList);
            for (int exp = 1; exp < Math.Pow(10, 9); exp *= 10)
            {
                Counting_sort(intList, exp);
            }

            string      plates;
            NumberPlate plate;

            var currentNode = intList.Head;

            for (int i = 0; i < n; i++)
            {
                plate  = new NumberPlate();
                plates = BackToPlate(plate, currentNode.Data);
                sortedList.InsertNodeAtEnd(plates);
                currentNode = currentNode.Next;
            }
        }
示例#7
0
 public void AddPlate(NumberPlate numberPlate)
 {
     Plates[Count++] = numberPlate;
 }