public static string[] DoubleSort(string[] DataTable)
        {
            Stopwatch NewStopwatch = new Stopwatch();

            string[] SortedDatatable = DataTable;
            NewStopwatch.Start();

            for (int i = 0; i < DataTable.Length; i++)
            {
                Console.WriteLine(i);
                for (int j = 0; j < DataTable.Length - 1; j++)
                {
                    string DataItem1 = DataTable[j].Split(',')[2];
                    string DataItem2 = DataTable[j + 1].Split(',')[2];

                    if (double.Parse(DataItem1) > double.Parse(DataItem2))
                    {
                        string Temp = DataTable[j];
                        DataTable[j]     = DataTable[j + 1];
                        DataTable[j + 1] = Temp;
                    }
                }
            }

            NewStopwatch.Stop();
            DataMaster.OutputData(SortedDatatable, NewStopwatch.ElapsedMilliseconds, SortType.DOUBLE, SortingAlgorithmType.BUBBLESORT);

            return(SortedDatatable);
        }
        public static string[] GUIDSort(string[] DataTable)
        {
            Stopwatch NewStopwatch = new Stopwatch();

            string[] SortedDatatable = DataTable;
            NewStopwatch.Start();

            for (int i = 0; i < DataTable.Length; i++)
            {
                Console.WriteLine(i);
                for (int j = 0; j < DataTable.Length - 1; j++)
                {
                    decimal DataItem1 = GUIDToDecimal.GetDecimalValue(DataTable[j].Split(',')[1]);
                    decimal DataItem2 = GUIDToDecimal.GetDecimalValue(DataTable[j + 1].Split(',')[1]);

                    if (DataItem1 > DataItem2)
                    {
                        string Temp = DataTable[j];
                        DataTable[j]     = DataTable[j + 1];
                        DataTable[j + 1] = Temp;
                    }
                }
            }

            NewStopwatch.Stop();
            DataMaster.OutputData(SortedDatatable, NewStopwatch.ElapsedMilliseconds, SortType.GUID, SortingAlgorithmType.BUBBLESORT);

            return(SortedDatatable);
        }
        public static string[] DoubleSort(string[] DataTable)
        {
            Stopwatch     NewStopwatch    = new Stopwatch();
            List <string> SortedDatatable = DataTable.ToList <string>();

            NewStopwatch.Start();

            SortedDatatable = CheckThenSplit(SortedDatatable, SortType.DOUBLE);

            NewStopwatch.Stop();
            DataMaster.OutputData(SortedDatatable.ToArray <string>(), NewStopwatch.ElapsedMilliseconds, SortType.DOUBLE, SortingAlgorithmType.MERGESORT);

            return(SortedDatatable.ToArray <string>());
        }
Example #4
0
        public static string[] GUIDSort(string[] DataTable)
        {
            Stopwatch      NewStopwatch = new Stopwatch();
            IList <string> ListTable    = DataTable.ToList <string>();

            NewStopwatch.Start();

            //
            QuicksortParallel <string>(ListTable, 0, ListTable.Count - 1, SortType.GUID);

            NewStopwatch.Stop();
            string[] SortedDatatable = ListTable.ToArray <string>();
            DataMaster.OutputData(SortedDatatable, NewStopwatch.ElapsedMilliseconds, SortType.GUID, SortingAlgorithmType.QUICKSORT);

            return(SortedDatatable);
        }
Example #5
0
        public static string[] DoubleSort(string[] DataTable)
        {
            Stopwatch stopwatch = new Stopwatch();

            string[] sortedDataTable = DataTable;
            stopwatch.Start();

            for (int i = 1; i < DataTable.Length; i++)
            {
                for (int j = i; j > 0 && Convert.ToDouble(sortedDataTable[j].Split(',')[2]) < Convert.ToDouble(sortedDataTable[j - 1].Split(',')[2]); j--)
                {
                    string lesserItem  = sortedDataTable[j].Split(',')[2];
                    string greaterItem = sortedDataTable[j - 1].Split(',')[2];

                    sortedDataTable[j].Split(',')[2]     = greaterItem;
                    sortedDataTable[j - 1].Split(',')[2] = lesserItem;
                }
            }

            stopwatch.Stop();
            DataMaster.OutputData(sortedDataTable, stopwatch.ElapsedMilliseconds, SortType.DOUBLE, SortingAlgorithmType.INSERTIONSORT);

            return(sortedDataTable);
        }
Example #6
0
        public static string[] GUIDSort(string[] DataTable)
        {
            Stopwatch stopwatch = new Stopwatch();

            string[] sortedDataTable = DataTable;
            stopwatch.Start();

            for (int i = 1; i < DataTable.Length; i++)
            {
                for (int j = i; j > 0 && GUIDToDecimal.GetDecimalValue(DataTable[j].Split(',')[1]) < GUIDToDecimal.GetDecimalValue(DataTable[j - 1].Split(',')[1]); j--)
                {
                    string lesserItem  = sortedDataTable[j].Split(',')[1];
                    string greaterItem = sortedDataTable[j - 1].Split(',')[1];

                    sortedDataTable[j].Split(',')[1]     = greaterItem;
                    sortedDataTable[j - 1].Split(',')[1] = lesserItem;
                }
            }

            stopwatch.Stop();
            DataMaster.OutputData(sortedDataTable, stopwatch.ElapsedMilliseconds, SortType.GUID, SortingAlgorithmType.INSERTIONSORT);

            return(sortedDataTable);
        }