ignore above status...i was looking at two problems simulataneously...posted on the wrong one... apologies...really its embarrasing.
On Fri, Jul 29, 2011 at 8:11 PM, snehi jain <snehijai...@gmail.com> wrote: > thanks .. > @siddhartha : i know the hashing technique ... and the problem of longer > strings can be reduced by subtracting a large constant value from the ASCII > value of all the characters .. and its not only with cubes even if u add > squares of ascii values ... i think it will work . > > @saurabh : in what context should i use bitfield ... > > > > On Fri, Jul 29, 2011 at 7:36 PM, saurabh singh <saurab...@gmail.com>wrote: > >> use a bitfield to optimize space >> >> >> On Fri, Jul 29, 2011 at 7:14 PM, Siddharth kumar < >> siddhartha.baran...@gmail.com> wrote: >> >>> #include<iostream> >>> #include<string.h> >>> >>> using namespace std; >>> >>> int main() >>> { >>> char str1[] = "sdfgkirertyujvcheddirtyutrdfgrtyuigfkrertyuijhgfdshh"; >>> char str2[] = "redirtyhgfdshhrtyrsujvcheierdutrdfgrtyuigfkdfgktyuij"; >>> int len1 = strlen(str1), len2 = strlen(str2); >>> >>> if(len1 != len2) >>> { >>> cout<<"Both are not anagram of each other."; >>> return 0; >>> } >>> else >>> { >>> int rep_char1[26] = {0}, rep_char2[26] = {0}, i; >>> >>> for(i=0; i<len1; i++) >>> { >>> rep_char1[str1[i]-'a']++; >>> rep_char2[str2[i]-'a']++; >>> } >>> >>> for(i=0; i<26; i++) >>> if(rep_char1[i] != rep_char2[i]) >>> { >>> cout<<"Both are not anagram of each other."; >>> return 0; >>> } >>> >>> cout<<"Both are anagram of each other."; >>> } >>> return 0; >>> } >>> >>> >>> >>> -- >>> Siddharth Kumar >>> BE 4th year, Computer Engineering >>> (Delhi College of Engineering) >>> +919711559760 >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to algogeeks@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> >> >> -- >> Saurabh Singh >> B.Tech (Computer Science) >> MNNIT ALLAHABAD >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.