write c or c++  program to check if one string is permutation of another string. This is a simple interview question for a programmer. For example if one string is “hello” and another is llheo ,then both the strings are permutation of each other. Let us discuss solution.

Sort method with O(n*log(n)) complexity

  1. if given strings are not equal , print no else
  2. sort both the strings.
  3. compare both strings with respect to their indexes.
  4. if both strings are equal print yes
  5. else print no.

c++ program check if one string is permutation of another string

Ref:

http://stackoverflow.com/questions/2131997/checking-if-two-strings-are-permutations-of-each-other