본문 바로가기

hash table3

[LEET CODE] 3. Longest Substring Without Repeating Characters # Problem Given a string s, find the length of the longest substring without repeating characters. Constraints: 0 2021. 4. 5.
[LEET CODE] 771. Jewels and Stones # Problem You're given strings jewels representing the types of stones that are jewels, and stones representing the stones you have. Each character in stones is a type of stone you have. You want to know how many of the stones you have are also jewels. Letters are case sensitive, so "a" is considered a different type of stone from "A". Constraints: 1 int: freqs = {} count = 0 # 돌(S)의 빈도 수 계산 for.. 2021. 4. 5.
[코딩 + 알고리즘 완주반] 13일차. 해쉬 테이블 (Hash Table) # 해쉬 구조 해쉬 테이블: 키에 데이터를 저장하는 데이터 구조 키를 통해 바로 데이터를 받아올 수 있으므로 속도가 획기적으로 빨라짐 ex) 파이선 딕셔너리 (파이썬에서는 해쉬를 별도 구현할 필요없음) 보통 배열로 미리 Hash Table 사이즈만큼 생성 후에 사용 ( 공간과 탐색을 맞바꾸는 기법) # 알아둘 용어 해쉬 (Hash) : 임의 값을 고정 길이로 변환하는 것 해쉬 테이블 (Hash Table) : 키 값의 연산에 의해 직접 접근이 가능한 데이터 구조 해싱 함수 (Hashing Function) : 키에 대해 산술 연산을 이용해 데이터 위치를 찾을 수 있는 함수 해쉬 값 (Hash Value ) 또는 해쉬 주소(Hash Address) : 키를 해싱 함수로 연산해서 해쉬 값을 알아내고, 이를 .. 2021. 3. 27.
반응형