Essays.club - Получите бесплатные рефераты, курсовые работы и научные статьи
Поиск

Отчет по лекции по «Параллельному и облачному вычислению»

Автор:   •  Апрель 17, 2023  •  Лекция  •  1,949 Слов (8 Страниц)  •  85 Просмотры

Страница 1 из 8

Федеральное государственное бюджетное образовательное учреждение высшего образования

«Саратовский государственный технический университет имени Гагарина Ю.А.»

Институт машиностроения, материаловедения и транспорта

Кафедра «Техническая механика и мехатроника»

Отчет по лекции №3

по дисциплине: «Параллельные и облачные вычисления»

 

Саратов 2023


1. Задание

[pic 1]


2. Программная часть.

using System;

using System.Diagnostics;

namespace Univ_POV_3

{

    internal class Program

    {

        static void Main(string[] args)

        {

            Measure(1000);

            Measure(5000);

            Measure(10000);

            Measure(50000);

            TestSort();

           

            Console.ReadLine();

        }

        public static void Measure(int arrLenth)

        {

            int[] arr = RandArr(arrLenth);

            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            arr.InsertionSorting();

            stopwatch.Stop();

            Console.WriteLine($"Elapsed Time is {stopwatch.ElapsedMilliseconds} ms from {arrLenth} elements");

        }

        public static void TestSort()

        {

            Console.WriteLine();

            int[] arr = RandArr(100);

            arr.Log();

            arr.InsertionSorting();

            arr.Log();

        }

        public static void MeasureDef(int arrLenth)

        {

            int[] arr = RandArr(arrLenth);

            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            Array.Sort(arr);

            stopwatch.Stop();

            Console.WriteLine($"Elapsed Time is {stopwatch.ElapsedMilliseconds} ms from {arrLenth} elements");

        }

        public static int[] RandArr(int length)

        {

            int[] arr = new int[length];

            Random random = new Random();

            for (int i = 0; i < length; i++)

            {

                arr[i] = random.Next(1000);

            }

            return arr;

        }

    }

    public static class BaseExtensions

    {

        public static void InsertionSorting(this int[] arr)

        {

            for (int i = 1; i < arr.Length; i++)

            {

                var key = arr[i];

                var flag = 0;

                for (int j = i - 1; j >= 0 && flag != 1;)

                {

                    if (key < arr[j])

                    {

                        arr[j + 1] = arr[j];

                        j--;

                        arr[j + 1] = key;

                    }

                    else flag = 1;

                }

            }

        }

        private static void SortMerge(this int[] arr, int left, int right, int mid)

        {

            int[] temp = new int[25];

...

Скачать:   txt (7.1 Kb)   pdf (118.8 Kb)   docx (187.3 Kb)  
Продолжить читать еще 7 страниц(ы) »
Доступно только на Essays.club