mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 08:16:50 +08:00
merge: Fix IsPalindrome Big-O analysis (#1054)
* Fix IsPalindrome Big-O analysis * Updated Documentation in README.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@ -10,7 +10,8 @@
|
||||
* Big-O Analysis
|
||||
* Time Complexity
|
||||
- O(N) on average and worst case scenario as input is traversed in linear fashion
|
||||
- O(N) on best case scenario, even when input has length of 1, because toString() method takes O(N)
|
||||
- O(1) on best case scenario if the input already is a string (otherwise toString() method takes O(N))
|
||||
and the first & last characters don't match, triggering an early return
|
||||
* Space Complexity
|
||||
- O(1)
|
||||
*/
|
||||
|
Reference in New Issue
Block a user