From 759c0eab916b91282d299e14c6810499527cf540 Mon Sep 17 00:00:00 2001 From: volkovva Date: Sat, 23 May 2026 19:22:09 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B2=D1=8B=D1=87=D0=B8=D1=81=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B8=D0=BD=D0=B4=D0=B5=D0=BA=D1=81=D0=B0?= =?UTF-8?q?,=20=D0=BD=D0=B0=D1=87=D0=B0=D0=BB=D0=BE=20=D1=85=D0=B5=D1=88?= =?UTF-8?q?=20=D1=82=D0=B0=D0=B1=D0=BB=D0=B8=D1=86=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VolkovVA/cod.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/VolkovVA/cod.py b/VolkovVA/cod.py index 25c43b5..65d46fc 100644 --- a/VolkovVA/cod.py +++ b/VolkovVA/cod.py @@ -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) +