[algogeeks] Re: check string A and B isPermutation ?

2006-04-11 Thread Timak
[EMAIL PROTECTED] writes: > So this is no better than just having an array of the counts per > character, in terms of space and worse in terms of speed. :-/ Actually, what was I thinking, the radix approach would be better, spacewise. In terms of space it would require O(w) space where w is the

[algogeeks] Re: check string A and B isPermutation ?

2006-04-11 Thread timak
I should clarify my post with that on each next step you partition the partitions. However, this means that extra space is not zero. Partitioning positions (at least one per bit) need to be stored. So this is no better than just having an array of the counts per character, in terms of space and

[algogeeks] Re: check string A and B isPermutation ?

2006-04-11 Thread timak
With the prime number approach you would need to somehow facilitate large numbers. Also, you need to store those primes which would take a lot of space, although admittedly you only need to take that space once. In addition, multiplication is a much heavier opperation than increment. BiGYaN's a

[algogeeks] Re: check string A and B isPermutation ?

2006-04-11 Thread Padmanabhan Natarajan
How about the prime number approach I mentioned above. Any comments?On 4/11/06, Dhyanesh <[EMAIL PROTECTED] > wrote:I also particularly dont like radix sort. Because it is kind of a hack. It is not a comparison based sort. It will work with charactersas you have here. But what if you have not two s

[algogeeks] Re: check string A and B isPermutation ?

2006-04-11 Thread Dhyanesh
I also particularly dont like radix sort. Because it is kind of a hack. It is not a comparison based sort. It will work with characters as you have here. But what if you have not two strings of characters, but two arrays of "objects" which you can only "compare". You would not be able to apply rad

[algogeeks] Re: check string A and B isPermutation ?

2006-04-11 Thread BiGYaN
Assuming that you cannot have any letter repeated more than 15 times. Create a struct of 26, 4 bit bitfields. This is going to take 26x4 bits or 13 bytes of memory. Use this structure to store the character count of each character of the first string. Now proceed to the second string and for ea

[algogeeks] Re: check string A and B isPermutation ?

2006-04-11 Thread Kevin
Talking about radix sorting, my experience is that many job interviewers (who are coders/developer themselvef) do not like it. Each time when I mentioned it, they usually did not get happy with it. What could be the reason? Any bad things in practical for radix sorting? --~--~-~--~~

[algogeeks] Re: check string A and B isPermutation ?

2006-04-11 Thread Kevin
Wrong. Say, A is "abcd", twice of it is C "abcdabcd" B is "bdca", B should be the premutation of A, but not a substring of C. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this

[algogeeks] NP-completeness

2006-04-11 Thread RJo
Anyone know where I can find a thorough list of NP completeness problems (ex. finding if problems are NP, NP complete, reduction, etc.) and their solutions? Let me know RJO --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

[algogeeks] Re: check string A and B isPermutation ?

2006-04-11 Thread [EMAIL PROTECTED]
i think we just construct a string C that repeate string A twice, for example, string A is 'abcd', and string C is 'abcdabcd', then check whether string B is a substring of string C. by the way, the string C can be saved by utilizing string A and modular function, for example, the char at positio

[algogeeks] Re: Some problems

2006-04-11 Thread pramod
Certainly not. Both are from CLR. Moreover I am not student anymore. BTW any solutions? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googleg