Skip to content

Commit 9483eb0

Browse files
committed
Cleaned up C# source files
Removed trailing whitespace, changed line endings from CRLF to LF and removed the UTF-8 BOM
1 parent 29303df commit 9483eb0

File tree

18 files changed

+260
-260
lines changed

18 files changed

+260
-260
lines changed
Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
// submitted by Julian Schacher (jspp) with great help by gustorn
2-
using System;
3-
using System.Collections.Generic;
4-
5-
namespace JarvisMarch
6-
{
7-
class Program
8-
{
9-
static void Main(string[] args)
10-
{
11-
System.Console.WriteLine("JarvisMarch");
12-
// Example list of points.
13-
// The points are represented by vectors here, but that doesn't really matter.
14-
var points = new List<Vector>()
15-
{
16-
new Vector(1, 3),
17-
new Vector(2, 4),
18-
new Vector(4, 0),
19-
new Vector(1, 0),
20-
new Vector(0, 2),
21-
new Vector(2, 2),
22-
new Vector(3, 4),
23-
new Vector(3, 1),
24-
};
25-
var jarvisMarch = new JarvisMarch();
26-
var giftWrap = jarvisMarch.Run(points);
27-
28-
// Print the points of the gift wrap.
29-
foreach (var point in giftWrap)
30-
System.Console.WriteLine($"{point.x}, {point.y}");
31-
}
32-
}
33-
}
1+
// submitted by Julian Schacher (jspp) with great help by gustorn
2+
using System;
3+
using System.Collections.Generic;
4+
5+
namespace JarvisMarch
6+
{
7+
class Program
8+
{
9+
static void Main(string[] args)
10+
{
11+
System.Console.WriteLine("JarvisMarch");
12+
// Example list of points.
13+
// The points are represented by vectors here, but that doesn't really matter.
14+
var points = new List<Vector>()
15+
{
16+
new Vector(1, 3),
17+
new Vector(2, 4),
18+
new Vector(4, 0),
19+
new Vector(1, 0),
20+
new Vector(0, 2),
21+
new Vector(2, 2),
22+
new Vector(3, 4),
23+
new Vector(3, 1),
24+
};
25+
var jarvisMarch = new JarvisMarch();
26+
var giftWrap = jarvisMarch.Run(points);
27+
28+
// Print the points of the gift wrap.
29+
foreach (var point in giftWrap)
30+
System.Console.WriteLine($"{point.x}, {point.y}");
31+
}
32+
}
33+
}
Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
// submitted by Julian Schacher (jspp), thanks to gustorn for the help
2-
using System.Collections;
3-
using System.Collections.Generic;
4-
5-
namespace HuffmanCoding
6-
{
7-
class Program
8-
{
9-
static void Main(string[] args)
10-
{
11-
var huffmanCoding = new HuffmanCoding();
12-
13-
var result = huffmanCoding.Encode("bibbity bobbity");
14-
// The bitStrings are just strings and provide no compression. Look in HuffmanCoding.cs for explanation.
15-
// Print dictionary.
16-
foreach (var entry in result.Dictionary)
17-
System.Console.WriteLine($"{entry.Key} {entry.Value}");
18-
// Print BitString.
19-
System.Console.WriteLine($"{result.BitString} count: {result.BitString.Length}");
20-
21-
var originalString = huffmanCoding.Decode(result);
22-
System.Console.WriteLine(originalString);
23-
}
24-
}
1+
// submitted by Julian Schacher (jspp), thanks to gustorn for the help
2+
using System.Collections;
3+
using System.Collections.Generic;
4+
5+
namespace HuffmanCoding
6+
{
7+
class Program
8+
{
9+
static void Main(string[] args)
10+
{
11+
var huffmanCoding = new HuffmanCoding();
12+
13+
var result = huffmanCoding.Encode("bibbity bobbity");
14+
// The bitStrings are just strings and provide no compression. Look in HuffmanCoding.cs for explanation.
15+
// Print dictionary.
16+
foreach (var entry in result.Dictionary)
17+
System.Console.WriteLine($"{entry.Key} {entry.Value}");
18+
// Print BitString.
19+
System.Console.WriteLine($"{result.BitString} count: {result.BitString.Length}");
20+
21+
var originalString = huffmanCoding.Decode(result);
22+
System.Console.WriteLine(originalString);
23+
}
24+
}
2525
}

chapters/decision_problems/stable_marriage/code/cs/GaleShapleyAlgorithm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// submitted by Julian Schacher (jspp) with great help by gustorn and Marius Becker
1+
// submitted by Julian Schacher (jspp) with great help by gustorn and Marius Becker
22
using System.Collections.Generic;
33

44
namespace StableMarriageProblem

chapters/decision_problems/stable_marriage/code/cs/ListExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33

44
namespace StableMarriageProblem

chapters/decision_problems/stable_marriage/code/cs/Person.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// submitted by Julian Schacher (jspp) with great help by gustorn and Marius Becker
1+
// submitted by Julian Schacher (jspp) with great help by gustorn and Marius Becker
22
using System.Collections.Generic;
33

44
namespace StableMarriageProblem
Lines changed: 67 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,67 @@
1-
// submitted by Julian Schacher (jspp) with great help by gustorn and Marius Becker
2-
using System;
3-
using System.Collections.Generic;
4-
5-
namespace StableMarriageProblem
6-
{
7-
class Program
8-
{
9-
static void Main(string[] args)
10-
{
11-
Console.WriteLine("GaleShapleyAlgorithm");
12-
// Using men and women as an example.
13-
var men = new List<Man>()
14-
{
15-
new Man("A"),
16-
new Man("B"),
17-
new Man("C"),
18-
new Man("D"),
19-
new Man("E")
20-
};
21-
var women = new List<Woman>()
22-
{
23-
new Woman("F"),
24-
new Woman("G"),
25-
new Woman("H"),
26-
new Woman("I"),
27-
new Woman("J"),
28-
};
29-
30-
var random = new Random();
31-
32-
foreach (var man in men)
33-
{
34-
man.Choices = new List<Woman>(women).Shuffle(random);
35-
Console.WriteLine(man.Name + ":");
36-
foreach (var choice in man.Choices)
37-
Console.Write(choice.Name);
38-
Console.WriteLine();
39-
}
40-
foreach (var woman in women)
41-
{
42-
woman.Choices = new List<Man>(men).Shuffle(random);
43-
Console.WriteLine(woman.Name + ":");
44-
foreach (var choice in woman.Choices)
45-
Console.Write(choice.Name);
46-
Console.WriteLine();
47-
}
48-
49-
GaleShapleyAlgorithm<Woman, Man>.RunGaleShapleyAlgorithm(women, men);
50-
51-
foreach (var woman in women)
52-
{
53-
Console.WriteLine(woman.Name + " : " + woman?.Partner.Name);
54-
}
55-
}
56-
}
57-
58-
public class Man : Person<Man, Woman>
59-
{
60-
public Man(string name) : base(name) { }
61-
}
62-
63-
public class Woman : Person<Woman, Man>
64-
{
65-
public Woman(string name) : base(name) { }
66-
}
67-
}
1+
// submitted by Julian Schacher (jspp) with great help by gustorn and Marius Becker
2+
using System;
3+
using System.Collections.Generic;
4+
5+
namespace StableMarriageProblem
6+
{
7+
class Program
8+
{
9+
static void Main(string[] args)
10+
{
11+
Console.WriteLine("GaleShapleyAlgorithm");
12+
// Using men and women as an example.
13+
var men = new List<Man>()
14+
{
15+
new Man("A"),
16+
new Man("B"),
17+
new Man("C"),
18+
new Man("D"),
19+
new Man("E")
20+
};
21+
var women = new List<Woman>()
22+
{
23+
new Woman("F"),
24+
new Woman("G"),
25+
new Woman("H"),
26+
new Woman("I"),
27+
new Woman("J"),
28+
};
29+
30+
var random = new Random();
31+
32+
foreach (var man in men)
33+
{
34+
man.Choices = new List<Woman>(women).Shuffle(random);
35+
Console.WriteLine(man.Name + ":");
36+
foreach (var choice in man.Choices)
37+
Console.Write(choice.Name);
38+
Console.WriteLine();
39+
}
40+
foreach (var woman in women)
41+
{
42+
woman.Choices = new List<Man>(men).Shuffle(random);
43+
Console.WriteLine(woman.Name + ":");
44+
foreach (var choice in woman.Choices)
45+
Console.Write(choice.Name);
46+
Console.WriteLine();
47+
}
48+
49+
GaleShapleyAlgorithm<Woman, Man>.RunGaleShapleyAlgorithm(women, men);
50+
51+
foreach (var woman in women)
52+
{
53+
Console.WriteLine(woman.Name + " : " + woman?.Partner.Name);
54+
}
55+
}
56+
}
57+
58+
public class Man : Person<Man, Woman>
59+
{
60+
public Man(string name) : base(name) { }
61+
}
62+
63+
public class Woman : Person<Woman, Man>
64+
{
65+
public Woman(string name) : base(name) { }
66+
}
67+
}

chapters/euclidean_algorithm/code/cs/EuclideanAlgorithm/EuclideanAlgorithm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// submitted by Julian Schacher (jspp)
1+
// submitted by Julian Schacher (jspp)
22
using System;
33

44
namespace EuclideanAlgorithm
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
// submitted by Julian Schacher (jspp)
2-
using System;
3-
4-
namespace EuclideanAlgorithm
5-
{
6-
class Program
7-
{
8-
static void Main(string[] args)
9-
{
10-
Console.WriteLine("EuclideanAlgorithm");
11-
int check = EuclideanAlgorithm.EuclidMod(64 * 67, 64 * 81);
12-
int check2 = EuclideanAlgorithm.EuclidSub(128 * 12, 128 * 77);
13-
14-
Console.WriteLine(check);
15-
Console.WriteLine(check2);
16-
}
17-
}
18-
}
1+
// submitted by Julian Schacher (jspp)
2+
using System;
3+
4+
namespace EuclideanAlgorithm
5+
{
6+
class Program
7+
{
8+
static void Main(string[] args)
9+
{
10+
Console.WriteLine("EuclideanAlgorithm");
11+
int check = EuclideanAlgorithm.EuclidMod(64 * 67, 64 * 81);
12+
int check2 = EuclideanAlgorithm.EuclidSub(128 * 12, 128 * 77);
13+
14+
Console.WriteLine(check);
15+
Console.WriteLine(check2);
16+
}
17+
}
18+
}

chapters/euclidean_algorithm/code/cs/EuclideanAlgorithmMdAdditional/EuclideanAlgorithmMdAdditional.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// submitted by Julian Schacher (jspp)
1+
// submitted by Julian Schacher (jspp)
22
namespace EuclideanAlgorithmMdAdditional
33
{
44
public class EuclideanAlgorithmMdAdditional
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
// submitted by Julian Schacher (jspp)
2-
using System;
3-
4-
namespace EuclideanAlgorithmMdAdditional
5-
{
6-
class Program
7-
{
8-
static void Main(string[] args)
9-
{
10-
Console.WriteLine("EuclideanAlgorithmMdAdditional");
11-
int checkMdAdditional = EuclideanAlgorithmMdAdditional.EuclidMod(64 * 67, 64 * 81);
12-
int checkMdAdditional2 = EuclideanAlgorithmMdAdditional.EuclidSub(128 * 12, 128 * 77);
13-
14-
Console.WriteLine(checkMdAdditional);
15-
Console.WriteLine(checkMdAdditional2);
16-
}
17-
}
18-
}
1+
// submitted by Julian Schacher (jspp)
2+
using System;
3+
4+
namespace EuclideanAlgorithmMdAdditional
5+
{
6+
class Program
7+
{
8+
static void Main(string[] args)
9+
{
10+
Console.WriteLine("EuclideanAlgorithmMdAdditional");
11+
int checkMdAdditional = EuclideanAlgorithmMdAdditional.EuclidMod(64 * 67, 64 * 81);
12+
int checkMdAdditional2 = EuclideanAlgorithmMdAdditional.EuclidSub(128 * 12, 128 * 77);
13+
14+
Console.WriteLine(checkMdAdditional);
15+
Console.WriteLine(checkMdAdditional2);
16+
}
17+
}
18+
}

chapters/sorting_searching/bogo/code/cs/BogoSort.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// submitted by Julian Schacher (jspp)
1+
// submitted by Julian Schacher (jspp)
22
using System;
33
using System.Collections.Generic;
44

0 commit comments

Comments
 (0)