Tweaked permutations challenge algorithm discussion.

This commit is contained in:
Donne Martin 2015-07-05 09:03:19 -04:00
parent d4d7c29c9d
commit 11bd2e9768

View File

@ -64,7 +64,7 @@
"source": [
"## Algorithm: Compare Sorted Strings\n",
"\n",
"Anagrams contain the same strings but in different orders. This approach could be slow for large strings due to sorting.\n",
"Permutations contain the same strings but in different orders. This approach could be slow for large strings due to sorting.\n",
"\n",
"* Sort both strings\n",
"* If both sorted strings are equal\n",
@ -74,7 +74,7 @@
"\n",
"Complexity:\n",
"* Time: O(n log n) from the sort, in general\n",
"* Space: Additional O(l + m) is created by the sorting algorithm, where l is the length of one string and m is the length of the other"
"* Space: O(n)"
]
},
{
@ -121,7 +121,7 @@
"\n",
"Complexity:\n",
"* Time: O(n)\n",
"* Space: Additional O(m), where m is the number of unique characters in the hash map"
"* Space: O(n)"
]
},
{