This is my playground. Here you will find grass, swings, slides, aunties sitting and talking on benches, old people walking, young people jogging, pesky little kids playing cricket and of course Me. Return to your work now, or be trapped here forever.
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).
to whom this message is directed at ....
ReplyDeleteNo one in particular. Maybe myself :)
ReplyDeleteCounter Retort :D
ReplyDeleteYes exactly.
ReplyDelete