Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation: Complexity of array assignment in Source §3,4 #1620

Closed
martin-henz opened this issue Mar 30, 2024 · 0 comments · Fixed by #1647
Closed

Documentation: Complexity of array assignment in Source §3,4 #1620

martin-henz opened this issue Mar 30, 2024 · 0 comments · Fixed by #1647
Labels
critical Fixing this is mission-critical Enhancement New feature or request

Comments

@martin-henz
Copy link
Member

We should make sure that we point out that array assignment in JavaScript is not O(1). Instead, we can only say that it's O(n) where n is the index.

const a = [];
a[1000000] = 0;

This does not necessarily run in constant time. Our explanation should be consistent with the fundamental property that time complexity is always greater or equal than space complexity, under the assumption that the input data is included in the space complexity and the time it takes to construct the input data is included in the time complexity.

@martin-henz martin-henz added Enhancement New feature or request critical Fixing this is mission-critical labels Mar 30, 2024
@martin-henz martin-henz changed the title Documenation: Complexity of array assignment in Source §3,4 Documentation: Complexity of array assignment in Source §3,4 Mar 30, 2024
martin-henz added a commit that referenced this issue Apr 7, 2024
martin-henz added a commit that referenced this issue Apr 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
critical Fixing this is mission-critical Enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant