feat(csharp/hashing): add code and update docs to chapter hashing (#568)

* feat(csharp/hashing): add code and update docs to chapter hashing

* revert linked list to list
This commit is contained in:
hpstory
2023-06-26 23:08:55 +08:00
committed by GitHub
parent 54dc288e61
commit 4722e7bca7
5 changed files with 422 additions and 0 deletions

View File

@ -338,7 +338,29 @@ $$
=== "C#"
```csharp title="built_in_hash.cs"
int num = 3;
int hashNum = num.GetHashCode();
// 整数 3 的哈希值为 3;
bool bol = true;
int hashBol = bol.GetHashCode();
// 布尔量 true 的哈希值为 1;
double dec = 3.14159;
int hashDec = dec.GetHashCode();
// 小数 3.14159 的哈希值为 -1340954729;
string str = "Hello 算法";
int hashStr = str.GetHashCode();
// 字符串 Hello 算法 的哈希值为 -586107568;
object[] arr = { 12836, "小哈" };
int hashTup = arr.GetHashCode();
// 数组 [12836, 小哈] 的哈希值为 42931033;
ListNode obj = new ListNode(0);
int hashObj = obj.GetHashCode();
// 节点对象 0 的哈希值为 39053774;
```
=== "Swift"