From 59531c6bd6141cc617a60c71598be7ecfec5be42 Mon Sep 17 00:00:00 2001 From: Dan D Date: Sun, 11 Apr 2021 19:22:51 -0400 Subject: [PATCH] Update anagrams.js Reference Javascript in anagram js epage --- book/analysis/anagrams.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/analysis/anagrams.js b/book/analysis/anagrams.js index 56cdf64f..493fdba9 100644 --- a/book/analysis/anagrams.js +++ b/book/analysis/anagrams.js @@ -91,7 +91,7 @@ assert.equal(false, anagramSortAndCompare('abcde', 'abcd')) At first glance you may be tempted to think that this algorithm is $$O(n)$$, since there is one simple iteration to compare the *n* characters after the sorting process. However, the two calls to the -Python `sorted` method are not without their own cost. Sorting is +Javascript `sort` method are not without their own cost. Sorting is typically either $$O(n^{2})$$ or $$O(n\log n)$$, so the sorting operations dominate the iteration. In the end, this algorithm will have the same order of magnitude as that of the sorting process.