直接寻址方式:
class HashTable: def __init__(self, length): self.T = [None for i in range(length)] class Data: def __init__(self, key, satelite_data): self.key = key self.satelite_data = satelite_data class Solution: def DIRECT_ADDRESS_SEARCH(self, T, k): return T[k] def DIRECT_ADDRESS_INSERT(self, T, x): T[x.key] = x def DIRECT_ADDRESS_DELETE(self, T, x): T[x.key] = None
时间: 2024-10-05 23:27:07