From f76c7b278e1b3c3bf10377d8176f4225a74549e5 Mon Sep 17 00:00:00 2001 From: Aviral Jain <74827110+Aviral1-jain@users.noreply.github.com> Date: Thu, 2 Oct 2025 13:40:38 +0530 Subject: [PATCH] Create timsort.py --- Python/sorting/timsort.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Python/sorting/timsort.py diff --git a/Python/sorting/timsort.py b/Python/sorting/timsort.py new file mode 100644 index 0000000..882f7b9 --- /dev/null +++ b/Python/sorting/timsort.py @@ -0,0 +1,9 @@ +# Using the sort() method +a = [5, 3, 1, 4, 6, 2] +a.sort() +print("Sorted list using sort():", a) + +# Using the sorted() function +a = [5, 3, 1, 4, 6, 2] +sorted_list = sorted(a) +print("Sorted list using sorted():", sorted_list)