From 3cba71c6e78e1a24aaeeeacb34a7f3495bb10b5b Mon Sep 17 00:00:00 2001 From: Alexander Date: Sun, 24 May 2026 23:21:43 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=B2=D1=8F=D0=B7=D0=BD=D1=8B=D0=B9=20?= =?UTF-8?q?=D1=81=D0=BF=D0=B8=D1=81=D0=BE=D0=BA=202.0(=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D1=88=D0=BB=D1=8B=D0=B9=20=D0=B1=D1=8B=D0=BB=20=D1=82=D0=B5?= =?UTF-8?q?=D1=81=D1=82=D0=BE=D0=B2=D1=8B=D0=B9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Task 1/Dogs/Data/{main.py => 1.py} | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) rename KuzminskiyAA/Task 1/Dogs/Data/{main.py => 1.py} (70%) diff --git a/KuzminskiyAA/Task 1/Dogs/Data/main.py b/KuzminskiyAA/Task 1/Dogs/Data/1.py similarity index 70% rename from KuzminskiyAA/Task 1/Dogs/Data/main.py rename to KuzminskiyAA/Task 1/Dogs/Data/1.py index 148494c..f9d5525 100644 --- a/KuzminskiyAA/Task 1/Dogs/Data/main.py +++ b/KuzminskiyAA/Task 1/Dogs/Data/1.py @@ -1,22 +1,22 @@ +import time +import random +import csv +import matplotlib.pyplot as plt +import numpy as np + def ll_insert(head, name, phone): - """Вставка в конец списка. Возвращает голову.""" new_node = {'name': name, 'phone': phone, 'next': None} - if head is None: return new_node - current = head - while current['next']: + while current: if current['name'] == name: current['phone'] = phone return head + if current['next'] is None: + current['next'] = new_node + return head current = current['next'] - - if current['name'] == name: - current['phone'] = phone - else: - current['next'] = new_node - return head def ll_find(head, name): @@ -30,24 +30,20 @@ def ll_find(head, name): def ll_delete(head, name): 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 current = current['next'] - return head def ll_list_all(head): - entries = [] + records = [] current = head while current: - entries.append((current['name'], current['phone'])) + records.append((current['name'], current['phone'])) current = current['next'] - entries.sort(key=lambda x: x[0]) - return entries \ No newline at end of file + return sorted(records, key=lambda x: x[0]) \ No newline at end of file