ABOUT ME

-

  • 패스트 캠퍼스 챌린지 11일차 - 자료구조 해쉬테이블 #2
    카테고리 없음 2021. 9. 16. 22:19

    목차

    1. 간단한 구현

    1. 간단한 구현

    hash_table = list([0 for i in range(8)])
    
    def get_key(data):
        return hash(data)
    
    def hash_function(key):
        return key % 8
    
    def save_data(data, value):
        hash_address = hash_function(get_key(data))
        hash_table[hash_address] = value
        
    def read_data(data):
        hash_address = hash_function(get_key(data))
        return hash_table[hash_address]

     

    https://bit.ly/37BpXiC

Designed by Tistory.