From 9a4efd68170eb457ae7314eee82928cf20c0c261 Mon Sep 17 00:00:00 2001 From: Lucas Date: Wed, 1 May 2024 23:58:39 -0700 Subject: [PATCH 1/2] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index ea21e17..9b10fef 100644 --- a/README.md +++ b/README.md @@ -371,6 +371,11 @@ string.islower() # The islower() method returns True if all cased characters in string.isdigit() string.isupper() # The isupper() method returns True if all cased characters in the string are uppercase and there is at least one cased character, False otherwise. ``` +The SortedList class from the sortedcontainers module is a data structure in Python that maintains a sorted list of elements while allowing for efficient insertion, deletion, and access operations. +It is implemented using a combination of binary search trees and dynamic arrays, which enables it to achieve efficient time complexities for these operations. +******Insertion and deletion operations in a SortedList have logarithmic time complexity on average O(logn), making it efficient for maintaining a sorted list even with a large number of elements. + +![image](https://github.com/Lucas-MW/PythonCheatSheet/assets/57050280/81334010-1469-451f-9da4-2157546b0183) # Built-in or Library functions From bc785e3ab5f201b279da4055e657e50de9b9f124 Mon Sep 17 00:00:00 2001 From: Lucas Date: Thu, 2 May 2024 00:01:04 -0700 Subject: [PATCH 2/2] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 9b10fef..d5cd0dd 100644 --- a/README.md +++ b/README.md @@ -372,7 +372,9 @@ string.isdigit() string.isupper() # The isupper() method returns True if all cased characters in the string are uppercase and there is at least one cased character, False otherwise. ``` The SortedList class from the sortedcontainers module is a data structure in Python that maintains a sorted list of elements while allowing for efficient insertion, deletion, and access operations. + It is implemented using a combination of binary search trees and dynamic arrays, which enables it to achieve efficient time complexities for these operations. + ******Insertion and deletion operations in a SortedList have logarithmic time complexity on average O(logn), making it efficient for maintaining a sorted list even with a large number of elements. ![image](https://github.com/Lucas-MW/PythonCheatSheet/assets/57050280/81334010-1469-451f-9da4-2157546b0183)