Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 07c1775

Browse files
Rename with standard C# naming conventions
1 parent 0245566 commit 07c1775

File tree

209 files changed

+2173
-2178
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

209 files changed

+2173
-2178
lines changed

‎src/Advanced.Algorithms/Binary/BaseConversion.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ public static string Convert(string srcNumber,
2727
var whole = tmp[0].TrimEnd();
2828
var fraction = tmp[1].TrimStart();
2929

30-
return convertWhole(whole, srcBaseChars, dstBaseChars) +
31-
"." + convertFraction(fraction, srcBaseChars, dstBaseChars, precision);
30+
return ConvertWhole(whole, srcBaseChars, dstBaseChars) +
31+
"." + ConvertFraction(fraction, srcBaseChars, dstBaseChars, precision);
3232
}
3333

34-
return convertWhole(srcNumber, srcBaseChars, dstBaseChars);
34+
return ConvertWhole(srcNumber, srcBaseChars, dstBaseChars);
3535
}
3636

3737
/// <summary>
3838
/// Converts the whole part of source number.
3939
/// </summary>
40-
private static string convertWhole(string srcNumber,
40+
private static string ConvertWhole(string srcNumber,
4141
string srcBaseChars,
4242
string dstBaseChars)
4343
{
@@ -77,7 +77,7 @@ private static string convertWhole(string srcNumber,
7777
/// <summary>
7878
/// Converts the fractional part of source number.
7979
/// </summary>
80-
private static string convertFraction(string srcNumber,
80+
private static string ConvertFraction(string srcNumber,
8181
string srcBaseChars,
8282
string dstBaseChars, int maxPrecision)
8383
{

‎src/Advanced.Algorithms/Combinatorics/Combination.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ public static List<List<T>> Find<T>(List<T> n, int r, bool withRepetition = fals
1111
{
1212
var result = new List<List<T>>();
1313

14-
recurse(n, r, withRepetition, 0, new List<T>(), new HashSet<int>(), result);
14+
Recurse(n, r, withRepetition, 0, new List<T>(), new HashSet<int>(), result);
1515

1616
return result;
1717
}
1818

19-
private static void recurse<T>(List<T> n, int r, bool withRepetition,
19+
private static void Recurse<T>(List<T> n, int r, bool withRepetition,
2020
int k, List<T> prefix, HashSet<int> prefixIndices,
2121
List<List<T>> result)
2222
{
@@ -33,7 +33,7 @@ private static void recurse<T>(List<T> n, int r, bool withRepetition,
3333
prefix.Add(n[j]);
3434
prefixIndices.Add(j);
3535

36-
recurse(n, r, withRepetition, j, prefix, prefixIndices, result);
36+
Recurse(n, r, withRepetition, j, prefix, prefixIndices, result);
3737

3838
prefix.RemoveAt(prefix.Count - 1);
3939
prefixIndices.Remove(j);

‎src/Advanced.Algorithms/Combinatorics/Permutation.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ public static List<List<T>> Find<T>(List<T> n, int r, bool withRepetition = fals
1111
{
1212
var result = new List<List<T>>();
1313

14-
recurse(n, r, withRepetition, new List<T>(), new HashSet<int>(), result);
14+
Recurse(n, r, withRepetition, new List<T>(), new HashSet<int>(), result);
1515

1616
return result;
1717
}
1818

19-
private static void recurse<T>(List<T> n, int r, bool withRepetition,
19+
private static void Recurse<T>(List<T> n, int r, bool withRepetition,
2020
List<T> prefix, HashSet<int> prefixIndices,
2121
List<List<T>> result)
2222
{
@@ -33,7 +33,7 @@ private static void recurse<T>(List<T> n, int r, bool withRepetition,
3333
prefix.Add(n[j]);
3434
prefixIndices.Add(j);
3535

36-
recurse(n, r, withRepetition, prefix, prefixIndices, result);
36+
Recurse(n, r, withRepetition, prefix, prefixIndices, result);
3737

3838
prefix.RemoveAt(prefix.Count - 1);
3939
prefixIndices.Remove(j);

‎src/Advanced.Algorithms/Combinatorics/Subset.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ public static List<List<T>> Find<T>(List<T> input)
1111
{
1212
var result = new List<List<T>>();
1313

14-
recurse(input, 0, new List<T>(), new HashSet<int>(), result);
14+
Recurse(input, 0, new List<T>(), new HashSet<int>(), result);
1515

1616
return result;
1717
}
1818

19-
private static void recurse<T>(List<T> input,
19+
private static void Recurse<T>(List<T> input,
2020
int k, List<T> prefix, HashSet<int> prefixIndices,
2121
List<List<T>> result)
2222
{
@@ -29,7 +29,7 @@ private static void recurse<T>(List<T> input,
2929
prefix.Add(input[j]);
3030
prefixIndices.Add(j);
3131

32-
recurse(input, j + 1, prefix, prefixIndices, result);
32+
Recurse(input, j + 1, prefix, prefixIndices, result);
3333

3434
prefix.RemoveAt(prefix.Count - 1);
3535
prefixIndices.Remove(j);

‎src/Advanced.Algorithms/Compression/HuffmanCoding.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class HuffmanCoding<T>
1414
/// </summary>
1515
public Dictionary<T, byte[]> Compress(T[] input)
1616
{
17-
var frequencies = computeFrequency(input);
17+
var frequencies = ComputeFrequency(input);
1818

1919
var minHeap = new BHeap<FrequencyWrap>();
2020

@@ -40,15 +40,15 @@ public Dictionary<T, byte[]> Compress(T[] input)
4040

4141
var result = new Dictionary<T, byte[]>();
4242

43-
dfs(root, new List<byte>(), result);
43+
Dfs(root, new List<byte>(), result);
4444

4545
return result;
4646
}
4747

4848
/// <summary>
4949
/// Now gather the codes.
5050
/// </summary>
51-
private void dfs(FrequencyWrap currentNode, List<byte> pathStack, Dictionary<T, byte[]> result)
51+
private void Dfs(FrequencyWrap currentNode, List<byte> pathStack, Dictionary<T, byte[]> result)
5252
{
5353
if (currentNode.IsLeaf)
5454
{
@@ -59,22 +59,22 @@ private void dfs(FrequencyWrap currentNode, List<byte> pathStack, Dictionary<T,
5959
if (currentNode.Left != null)
6060
{
6161
pathStack.Add(0);
62-
dfs(currentNode.Left, pathStack, result);
62+
Dfs(currentNode.Left, pathStack, result);
6363
pathStack.RemoveAt(pathStack.Count - 1);
6464
}
6565

6666
if (currentNode.Right != null)
6767
{
6868
pathStack.Add(1);
69-
dfs(currentNode.Right, pathStack, result);
69+
Dfs(currentNode.Right, pathStack, result);
7070
pathStack.RemoveAt(pathStack.Count - 1);
7171
}
7272
}
7373

7474
/// <summary>
7575
/// Computes frequencies of each of T in given input.
7676
/// </summary>
77-
private Dictionary<T, int> computeFrequency(T[] input)
77+
private Dictionary<T, int> ComputeFrequency(T[] input)
7878
{
7979
var result = new Dictionary<T, int>();
8080

‎src/Advanced.Algorithms/DataStructures/Dictionary/Dictionary.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ namespace Advanced.Algorithms.DataStructures.Foundation;
77
/// <summary>
88
/// A dictionary implementation.
99
/// </summary>
10-
/// <typeparam name="K">The key datatype.</typeparam>
11-
/// <typeparam name="V">The value datatype.</typeparam>
12-
public class Dictionary<K,V> : IEnumerable<KeyValuePair<K,V>>
10+
/// <typeparam name="TK">The key datatype.</typeparam>
11+
/// <typeparam name="TV">The value datatype.</typeparam>
12+
public class Dictionary<TK,TV> : IEnumerable<KeyValuePair<TK,TV>>
1313
{
14-
private readonly IDictionary<K,V> dictionary;
14+
private readonly IDictionary<TK,TV> dictionary;
1515

1616
/// <param name="type">The dictionary implementation to use.</param>
1717
/// <param name="initialBucketSize">The larger the bucket size lesser the collision, but memory matters!</param>
@@ -20,9 +20,9 @@ public Dictionary(DictionaryType type = DictionaryType.SeparateChaining, int ini
2020
if (initialBucketSize < 2) throw new Exception("Bucket Size must be greater than 2.");
2121

2222
if (type == DictionaryType.SeparateChaining)
23-
dictionary = new SeparateChainingDictionary<K,V>(initialBucketSize);
23+
dictionary = new SeparateChainingDictionary<TK,TV>(initialBucketSize);
2424
else
25-
dictionary = new OpenAddressDictionary<K,V>(initialBucketSize);
25+
dictionary = new OpenAddressDictionary<TK,TV>(initialBucketSize);
2626
}
2727

2828
/// <summary>
@@ -34,7 +34,7 @@ public Dictionary(DictionaryType type = DictionaryType.SeparateChaining, int ini
3434
/// Get/set value for given key.
3535
/// Time complexity: O(1) amortized.
3636
/// </summary>
37-
public V this[K key]
37+
public TV this[TK key]
3838
{
3939
get => dictionary[key];
4040
set => dictionary[key] = value;
@@ -45,7 +45,7 @@ IEnumerator IEnumerable.GetEnumerator()
4545
return GetEnumerator();
4646
}
4747

48-
public IEnumerator<KeyValuePair<K,V>> GetEnumerator()
48+
public IEnumerator<KeyValuePair<TK,TV>> GetEnumerator()
4949
{
5050
return dictionary.GetEnumerator();
5151
}
@@ -56,7 +56,7 @@ public IEnumerator<KeyValuePair<K, V>> GetEnumerator()
5656
/// </summary>
5757
/// <param name="value">The key to check.</param>
5858
/// <returns>True if this dictionary contains the given key.</returns>
59-
public bool ContainsKey(K key)
59+
public bool ContainsKey(TK key)
6060
{
6161
return dictionary.ContainsKey(key);
6262
}
@@ -67,7 +67,7 @@ public bool ContainsKey(K key)
6767
/// </summary>
6868
/// <param name="key">The key to add.</param>
6969
/// <param name="value">The value for the given key.</param>
70-
public void Add(K key, V value)
70+
public void Add(TK key, TV value)
7171
{
7272
dictionary.Add(key, value);
7373
}
@@ -77,7 +77,7 @@ public void Add(K key, V value)
7777
/// Time complexity: O(1) amortized.
7878
/// </summary>
7979
/// <param name="key">The key to remove.</param>
80-
public void Remove(K key)
80+
public void Remove(TK key)
8181
{
8282
dictionary.Remove(key);
8383
}
@@ -92,15 +92,15 @@ public void Clear()
9292
}
9393
}
9494

95-
internal interface IDictionary<K,V> : IEnumerable<KeyValuePair<K,V>>
95+
internal interface IDictionary<TK,TV> : IEnumerable<KeyValuePair<TK,TV>>
9696
{
97-
V this[K key] { get; set; }
97+
TV this[TK key] { get; set; }
9898

9999
int Count { get; }
100100

101-
bool ContainsKey(K key);
102-
void Add(K key, V value);
103-
void Remove(K key);
101+
bool ContainsKey(TK key);
102+
void Add(TK key, TV value);
103+
void Remove(TK key);
104104
void Clear();
105105
}
106106

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /