mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-10 06:26:08 +00:00
fix(csharp): Modify method name to PascalCase, simplify new expression (#840)
* Modify method name to PascalCase(array and linked list) * Modify method name to PascalCase(backtracking) * Modify method name to PascalCase(computational complexity) * Modify method name to PascalCase(divide and conquer) * Modify method name to PascalCase(dynamic programming) * Modify method name to PascalCase(graph) * Modify method name to PascalCase(greedy) * Modify method name to PascalCase(hashing) * Modify method name to PascalCase(heap) * Modify method name to PascalCase(searching) * Modify method name to PascalCase(sorting) * Modify method name to PascalCase(stack and queue) * Modify method name to PascalCase(tree) * local check
This commit is contained in:
@@ -8,7 +8,7 @@ namespace hello_algo.chapter_hashing;
|
||||
|
||||
public class simple_hash {
|
||||
/* 加法哈希 */
|
||||
public static int addHash(string key) {
|
||||
public static int AddHash(string key) {
|
||||
long hash = 0;
|
||||
const int MODULUS = 1000000007;
|
||||
foreach (char c in key) {
|
||||
@@ -18,7 +18,7 @@ public class simple_hash {
|
||||
}
|
||||
|
||||
/* 乘法哈希 */
|
||||
public static int mulHash(string key) {
|
||||
public static int MulHash(string key) {
|
||||
long hash = 0;
|
||||
const int MODULUS = 1000000007;
|
||||
foreach (char c in key) {
|
||||
@@ -28,7 +28,7 @@ public class simple_hash {
|
||||
}
|
||||
|
||||
/* 异或哈希 */
|
||||
public static int xorHash(string key) {
|
||||
public static int XorHash(string key) {
|
||||
int hash = 0;
|
||||
const int MODULUS = 1000000007;
|
||||
foreach (char c in key) {
|
||||
@@ -38,7 +38,7 @@ public class simple_hash {
|
||||
}
|
||||
|
||||
/* 旋转哈希 */
|
||||
public static int rotHash(string key) {
|
||||
public static int RotHash(string key) {
|
||||
long hash = 0;
|
||||
const int MODULUS = 1000000007;
|
||||
foreach (char c in key) {
|
||||
@@ -51,16 +51,16 @@ public class simple_hash {
|
||||
public void Test() {
|
||||
string key = "Hello 算法";
|
||||
|
||||
int hash = addHash(key);
|
||||
int hash = AddHash(key);
|
||||
Console.WriteLine("加法哈希值为 " + hash);
|
||||
|
||||
hash = mulHash(key);
|
||||
hash = MulHash(key);
|
||||
Console.WriteLine("乘法哈希值为 " + hash);
|
||||
|
||||
hash = xorHash(key);
|
||||
hash = XorHash(key);
|
||||
Console.WriteLine("异或哈希值为 " + hash);
|
||||
|
||||
hash = rotHash(key);
|
||||
hash = RotHash(key);
|
||||
Console.WriteLine("旋转哈希值为 " + hash);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user