bpo-33872: Add list elements access complexity by andresdelfino · Pull Request #7728 · python/cpython
| Lists are mutable sequences, typically used to store collections of | ||
| homogeneous items (where the precise degree of similarity will vary by | ||
| application). | ||
| application). List elements are accessed with a O(1). |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: "List elements are accessed with O(1) time complexity" or "Accessing list elements has O(1) time complexity".
"List elements are accessed with a O(1)" sounds a bit off to me.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO, mentioning "time complexity" is definitely an improvement, I'll rephrase, thanks :)
| application). | ||
|
|
||
| Despite its name, lists are more akin to arrays in other languages than to | ||
| linked lists, since its elements are accessed with time complexity O(1). |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use plural: “their name”, “their elements”, to agree with “lists are”
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😅 thanks!
| homogeneous items (where the precise degree of similarity will vary by | ||
| application). | ||
|
|
||
| Despite their name, lists are more akin to arrays in other languages than to |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
“despite their name” seems redundant.
“List” is datastructure independent, abstract word.
For example, C# uses IList and ArrayList for sequence (indexable). And LinkedList for linked list.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters