diff --git a/data_structures/arrays/strings/anagram_checker.rb b/data_structures/arrays/strings/anagram_checker.rb index 71f59d6..bcd5e36 100644 --- a/data_structures/arrays/strings/anagram_checker.rb +++ b/data_structures/arrays/strings/anagram_checker.rb @@ -20,6 +20,7 @@ # Complexity analysis: # # Time Complexity: O(n log n). Assume that n is the length of s, sorting costs O(n log n), and comparing two strings costs O(n). Sorting time dominates and the overall time complexity is O(n log n). +# Space Complexity: O(1). Space depends on the sorting implementation which, usually, costs O(1) auxiliary space if heapsort is used. # def is_anagram(s, t) return false if s.length != t.length