добавление ll_collect

This commit is contained in:
Dima 2026-05-10 21:03:20 +03:00
parent 809294edae
commit 57fa3a3232

View File

@ -72,6 +72,13 @@ def ll_delete(head, name):
return head
def ll_collect(head, result_list):
"""собирает все данные из связного списка в result_list"""
current = head
while current is not None:
result_list.append((current['name'], current['phone']))
current = current['next']
def ll_list_all(head):
@ -161,3 +168,12 @@ def ht_list_all(buckets):
# Сортируем пузырьком
bubble_sort(full_data)
return full_data
Hash_table1 = hash_table(3)
ht_insert(Hash_table1, 'Alena', '010')
ht_insert(Hash_table1, 'Helena', '111')
ht_insert(Hash_table1, 'Gena', '222')
print(ht_list_all(Hash_table1))