mirror of
https://github.com/krahets/hello-algo.git
synced 2026-11-01 18:55:23 +08:00
* feat(ko): add the complete Korean online edition * Use UTF-8 for Python CI output on Windows * Remove print-book promotion from the Korean site * fix(ko): preserve emphasis before Korean particles
37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
/**
|
|
* File: built_in_hash.cs
|
|
* Created Time: 2023-06-26
|
|
* Author: hpstory ([email protected])
|
|
*/
|
|
|
|
namespace hello_algo.chapter_hashing;
|
|
|
|
public class built_in_hash {
|
|
[Test]
|
|
public void Test() {
|
|
int num = 3;
|
|
int hashNum = num.GetHashCode();
|
|
Console.WriteLine("정수 " + num + " ; 해시값: " + hashNum);
|
|
|
|
bool bol = true;
|
|
int hashBol = bol.GetHashCode();
|
|
Console.WriteLine("불리언 값 " + bol + " ; 해시값: " + hashBol);
|
|
|
|
double dec = 3.14159;
|
|
int hashDec = dec.GetHashCode();
|
|
Console.WriteLine("소수 " + dec + " ; 해시값: " + hashDec);
|
|
|
|
string str = "Hello 算法";
|
|
int hashStr = str.GetHashCode();
|
|
Console.WriteLine("문자열 " + str + " ; 해시값: " + hashStr);
|
|
|
|
object[] arr = [12836, "小哈"];
|
|
int hashTup = arr.GetHashCode();
|
|
Console.WriteLine("배열 [" + string.Join(", ", arr) + "]의 해시값: " + hashTup);
|
|
|
|
ListNode obj = new(0);
|
|
int hashObj = obj.GetHashCode();
|
|
Console.WriteLine("노드 객체 " + obj + " ; 해시값: " + hashObj);
|
|
}
|
|
}
|