Timeline for Check string is permutation of palindrome
Current License: CC BY-SA 3.0
10 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 10, 2016 at 18:50 | comment | added | coderodde | @Olzhas No problem. No review is perfect. | |
| Oct 10, 2016 at 18:49 | comment | added | Incomputable | @coderrode, well, then I got it right :) sorry for nitpicking your posts all the time, I didn't really mean to. | |
| Oct 10, 2016 at 18:46 | comment | added | coderodde | @Olzhas "in order" means "reasonable" in that context. :^) | |
| Oct 10, 2016 at 18:31 | history | edited | coderodde | CC BY-SA 3.0 |
added 1800 characters in body
|
| Oct 10, 2016 at 18:17 | comment | added | Incomputable | I'm not really sure if I understand the question. If you mean why would one write it, it's because sometimes your input is not a string or a vector, so copying it would lead to overhead of copying it into string. I'm not really sure what order you mentioned. | |
| Oct 10, 2016 at 18:13 | comment | added | coderodde | @Olzhas Would a template function be in order? | |
| Oct 10, 2016 at 18:07 | comment | added | Incomputable |
Dealing with spaces actually adds needless noise. That restriction will make the code fallback to this: iterator should be forward iterator, and *it always should be char& or char. I was just thinking if the algorithm makes sense in problems without strings. About your question: no. The algorithm you've written will be the same, just the condition in while will change and parameters too. I believe you can make it work with input iterators too
|
|
| Oct 10, 2016 at 12:40 | comment | added | coderodde | @Olzhas So your point is that we can treat a class as the alphabet? | |
| Oct 9, 2016 at 18:32 | comment | added | Incomputable |
I would like to add that algorithm would be complete if you would make it work on iterator ranges. You could create an overload for const char* str, which will call main algorithm with str, str + strlen(str). The code needs minimal changes to be generic.
|
|
| Oct 9, 2016 at 16:45 | history | answered | coderodde | CC BY-SA 3.0 |