Monday, October 03, 2005
Permutation
Well, there was this sample google question on the notice board which went something like this: "How will you find whether string A is a permutation of string B?" . One method will be to actually make all the permutations and keep on comparing them with the other string. This is obviously inefficient as it takes O(N!) time. I did something else which takes O((N)^3) time (I think. I am not too good at analysis.). You just check whether all the characters in one string are there in the other string and their lengths are equal (obviously).
Subscribe to:
Post Comments (Atom)
4 comments:
to whom this message is directed at ....
No one in particular. Maybe myself :)
Counter Retort :D
Yes exactly.
Post a Comment