@Modelling expert.

#include<iostream>
#include<map>
#include<string>
using namespace std;
int main()
{
    string s="amazon";
    int i=0,j=0;
    map<char,int>mp;
    for(i=0;i<s.length();++i)
    {
                             mp[s.at(i)]++;
                             }
                             for(i=0;i<s.length();++i)
                             {
                                  cout<<s.at(i)<<mp[s.at(i)];
                                  }
                                  cin.sync();
                                  cin.get();
                                  return 0;
                                  }
PS.r u from Institute of mathematical Research science or CMI .......























On Sun, May 16, 2010 at 1:50 PM, Modeling Expert <
[email protected]> wrote:

> @sharad : Can you explain with same 'amazon' example for key mapping.
>  if we have O(K) hash map, how would we map keys as We need to
> 'remember' mapping to print things back .
> e.g. ASCII valueof (C1)% sizeof(string) could be equal to
> valueof(C2)%sizeof(string) where strins is  "C1C2..."
>
> @divya your solution looks OK to me , its would be O(k) for space,
> time O ( KlgK) , right ?
>
> On May 14, 8:20 am, sharad kumar <[email protected]> wrote:
> > cant u use a hash map ???? of O(K) where K is distinct elements in
> > string......
> >
> > On Thu, May 13, 2010 at 8:13 PM, jalaj jaiswal <
> [email protected]>wrote:
> >
> >
> >
> > > input a character array from the user and output in the following way.
> > > example string is amazon.. then output should be a2m1z1o1n1
> >
> > > i did it taking a 26 size array... some better solution ??
> >
> > > --
> > > With Regards,
> > > Jalaj Jaiswal
> > > +919026283397
> > > B.TECH IT
> > > IIIT ALLAHABAD
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Algorithm Geeks" group.
> > > To post to this group, send email to [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected]<algogeeks%[email protected]>
> <algogeeks%[email protected]<algogeeks%[email protected]>
> >
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/algogeeks?hl=en.
> >
> > --
> > yezhu malai vaasa venkataramana Govinda Govinda
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> [email protected]<algogeeks%[email protected]>
> .
> > For more options, visit this group athttp://
> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected]<algogeeks%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to