-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
39 lines (35 loc) · 1.32 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;
using System.Diagnostics;
namespace BalloonProblem
{
class Program
{
static void Main(string[] args)
{
var students = Seeder.GenerateStudents();
var balloons = Seeder.GenerateBalloons(students);
var hallway = new Hallway(balloons);
Stopwatch stopWatch = new Stopwatch();
Console.WriteLine("Linear remove starting");
stopWatch.Start();
foreach (var student in students)
{
hallway.DequeueBalloonLinear(student);
//For accurate timing you should comment out next line of code as IO is expensive
//Console.WriteLine($"{hallway.Count()} balloons remaining, {student.Name} found theirs");
}
stopWatch.Stop();
Console.WriteLine($"Linear remove finished in {stopWatch.ElapsedMilliseconds} ms");
stopWatch.Reset();
stopWatch.Start();
Console.WriteLine("Not real world solution hashmap starting");
foreach (var student in students)
{
hallway.FakeHashTableSolution(student);
}
stopWatch.Stop();
Console.WriteLine($"Hashmap finished in {stopWatch.ElapsedMilliseconds} ms");
Console.ReadLine();
}
}
}