Re: [algogeeks] I am new to CPP STL please help
strcmp is for C-style strings. Use in-built compare function of C++ strings ( http://www.cplusplus.com/reference/string/string/compare/ ), or why not simply '==' operator. -- Prakhar Jain IIIT Allahabad B.Tech IT 4th Year Mob no: +91 9454992196 E-mail: rit2009...@iiita.ac.in jprakha...@gmail.com On Thu, May 9, 2013 at 9:40 PM, Nishant Pandey nishant.bits.me...@gmail.com wrote: This is my code snippet #include iostream.h #include string #include set #include map #include vector #include sstream #include cctype using namespace std; void work() { mapstring, int name_age; mapint,string index_name; mapint,string index_name_temp; std::map int, string ::iterator it; name_age[abc] = 12; name_age[pqr] = 1; name_age[stu] = 13; index_name[0] = abc; index_name[1] = pqr; index_name[2] = stu; cout name_age[abc] endl; cout index_name[1]; name_age.erase(abc); index_name_temp[0] = abc'; for ( it = index_name.begin(); it != index_name.end(); ++it ) { cout (*it).second ; } In this i have deleted key abc first from hash table name_age in the next hash table index_namei have abc as value i want to erase the abc entry from index_name table too, The idea is to first iterate on hash_map index_name when found abc delete the entry from index_name but how to compare abc in index_name map. as we cant do if (strcmp((*it).second, abc) ==0 ) in this , how do i do the comparision please help } -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com.
Re: [algogeeks] I am new to CPP STL please help
Iterate through index_name, for each value you traverse, now try to find inside name_age by calling find on it. Now if it is found, put it temporary map. Now the iteration is over, clear index_name map. Put all the values from temporary map into _name map. On 9 May 2013 21:40, Nishant Pandey nishant.bits.me...@gmail.com wrote: This is my code snippet #include iostream.h #include string #include set #include map #include vector #include sstream #include cctype using namespace std; void work() { mapstring, int name_age; mapint,string index_name; mapint,string index_name_temp; std::map int, string ::iterator it; name_age[abc] = 12; name_age[pqr] = 1; name_age[stu] = 13; index_name[0] = abc; index_name[1] = pqr; index_name[2] = stu; cout name_age[abc] endl; cout index_name[1]; name_age.erase(abc); index_name_temp[0] = abc'; for ( it = index_name.begin(); it != index_name.end(); ++it ) { cout (*it).second ; } In this i have deleted key abc first from hash table name_age in the next hash table index_namei have abc as value i want to erase the abc entry from index_name table too, The idea is to first iterate on hash_map index_name when found abc delete the entry from index_name but how to compare abc in index_name map. as we cant do if (strcmp((*it).second, abc) ==0 ) in this , how do i do the comparision please help } -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. -- regards, soumya prasad ukil -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com.
[algogeeks] I am new to CPP STL please help
This is my code snippet #include iostream.h #include string #include set #include map #include vector #include sstream #include cctype using namespace std; void work() { mapstring, int name_age; mapint,string index_name; mapint,string index_name_temp; std::map int, string ::iterator it; name_age[abc] = 12; name_age[pqr] = 1; name_age[stu] = 13; index_name[0] = abc; index_name[1] = pqr; index_name[2] = stu; cout name_age[abc] endl; cout index_name[1]; name_age.erase(abc); index_name_temp[0] = abc'; for ( it = index_name.begin(); it != index_name.end(); ++it ) { cout (*it).second ; } In this i have deleted key abc first from hash table name_age in the next hash table index_namei have abc as value i want to erase the abc entry from index_name table too, The idea is to first iterate on hash_map index_name when found abc delete the entry from index_name but how to compare abc in index_name map. as we cant do if (strcmp((*it).second, abc) ==0 ) in this , how do i do the comparision please help } -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com.
[algogeeks] i am new
hi , i've recently joined this group in a mood to master the algorithms. Will someone tell ,weather i will be benifitted by this group or not. ??? -- 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.
Re: [algogeeks] i am new
Yes On 6 April 2011 11:36, a_SillyGuy ammukumar...@gmail.com wrote: hi , i've recently joined this group in a mood to master the algorithms. Will someone tell ,weather i will be benifitted by this group or not. ??? -- 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.
Re: [algogeeks] i am new
This is a great group. Here, we share our knowledge and get to know a lot of new algorithmic techniques. On Wed, Apr 6, 2011 at 4:08 PM, Carl Barton odysseus.ulys...@gmail.comwrote: Yes On 6 April 2011 11:36, a_SillyGuy ammukumar...@gmail.com wrote: hi , i've recently joined this group in a mood to master the algorithms. Will someone tell ,weather i will be benifitted by this group or not. ??? -- 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. -- Umer -- 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.
[algogeeks] I am new to this group!
Wow really this is great group i have figured out.. very very interesting love it... Thanks to all active memeber of this group -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@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.