sw.Start();
Console.Write(g.MaxTreeOptim()); // вызов оптимального метода
sw.Stop();
Console.WriteLine(" Прошло милисекунд: " + sw.Elapsed.TotalMilliseconds);
sw.Reset();
sw.Start();
Console.Write(g.MaxTreePerebor()); // вызов приближенного метода
sw.Stop();
Console.WriteLine(" Прошло милисекунд: " + sw.Elapsed.TotalMilliseconds);
}
catch (Exception)
{
Console.WriteLine("Ошибка. Введены не верные данные!");
return;
}
}
public static void Main(string[] args)
{
Console.WriteLine("ПОИСК МАКСИМАЛЬНОГО ПОКРЫВАЮЩЕГО ДЕРЕВА");
Console.WriteLine("---------------------------------------");
// ----------
while (true) // бесконечный цикл
{
Console.WriteLine("Меню:");
Console.WriteLine("-----");
Console.WriteLine("1. Тестовый пример\n" + "2. Ввод данных\n" + "3. Набор статистики (исп. генератор)\n");
Console.Write("Выберите пункт меню от 1 до 3 или [Enter] для выхода: ");
string userInput = Console.ReadLine();
if (userInput == "")
{
Console.WriteLine("Вы нажали [Enter] значит выходим...");
break;
}
try
{
int x = int.Parse(userInput);
switch (x)
{
case 1: Program.M1(); break;