Andrexxelles

Untitled

Jan 7th, 2025
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1. using System;
  2. using System.Diagnostics;
  3. using System.Linq;
  4.  
  5. namespace TestProject;
  6.  
  7. public static class Program
  8. {
  9.     public static void Main(string[] args)
  10.     {
  11.         LongestHarmoniousSubsequence problem = new LongestHarmoniousSubsequence();
  12.  
  13.         int[] data = []; // really large data
  14.  
  15.         TimeSpan delta = new TimeSpan();
  16.         int repeats = 100;
  17.        
  18.         for (int i = 0; i < repeats; i++)
  19.         {
  20.             Stopwatch measure = Stopwatch.StartNew();
  21.             int length = problem.FindLHS(data);
  22.             measure.Stop();
  23.        
  24.             delta += measure.Elapsed;
  25.         }
  26.        
  27.         Console.WriteLine($"Length - \nTIme - {delta / repeats}");
  28.  
  29.         // Stopwatch measure = Stopwatch.StartNew();
  30.         // int length = problem.FindLHS(data);
  31.         // measure.Stop();
  32.         // Console.WriteLine($"Length - {length}\nTIme - {measure.Elapsed}");
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment