forked from UNN/2026-rff_mp
[1] 1-st-exercise #2
|
|
@ -1,5 +1,5 @@
|
|||
import random as rnd
|
||||
<<<<<<< HEAD
|
||||
|
||||
|
||||
def ll_insert(head, name, phone):
|
||||
new_node = {'name': name, 'phone': phone, 'next': None}
|
||||
|
|
@ -61,5 +61,21 @@ def ll_list_all(head):
|
|||
current = current['next']
|
||||
res = sort_records(record)
|
||||
return res
|
||||
=======
|
||||
>>>>>>> 221b0dbe36c30826c59c8721814c9bb881eafeee
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def def_hash(name, size):
|
||||
hash_value = 0
|
||||
for char in name:
|
||||
hash_value += ord(char)
|
||||
final_idx = hash_value % size
|
||||
return final_idx
|
||||
|
||||
def ht_insert(buckets, name, phone):
|
||||
size = len(buckets)
|
||||
idx = def_hash(name, size)
|
||||
ll_insert(buckets[idx], name, phone)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user