develop #1

Open
FirsovAV wants to merge 1141 commits from UNN/2026-rff_mp:develop into develop
Showing only changes of commit 2f7370eb01 - Show all commits

View File

@ -1,12 +1,44 @@
def ll_create_node(name, phone):
return {'name': name, 'phone': phone}
def ll_insert(head, name, phone):
{'name': name, 'phone': phone}
pass
if head is None:
return ll_create_node(name, phone)
current = head
while current:
if current ['name'] == name:
current['phone'] = phone
return head
if current ['next'] is None:
break
current = current['next']
current['next'] = ll_create_node(name, phone)
return head
def ll_find(head, name):
pass
current = head
while current:
if current['name'] == name:
return current['phone']
current = current['next']
return None
def ll_delete(head, name):
pass
if head is None:
return None
if head['name'] == name:
return head['next']
current = head
while current['next']:
if current['next']['name'] == name:
current['next'] = current['next']['next']
return head
def ll_list_all(head):
pass
items = []
current = head
while current:
items.append((current['name'], current['phone']))
current = current['next']
return sorted(items, key=lambda x:x[0])