For 2nd question : @Ishan : U'r code is not giving compilation error in gcc
.. it is going into infinite loop ..
This is working fine ..
#include<stdio.h>
#include<string.h>
int main()
{
int temp1[256];
int i=0;
char str[50] = "Battle of the vowels: Hawaii vs. Gronzy";
char temp[6] = "aeiou";
for(i=0;i<256;i++)
temp1[i] = 0;
i=0;
while(temp[i])
{
temp1[temp[i]] = 1;
i++;
}
i=0;
int flag=0,tail=0;
while(str[i])
{
if(temp1[str[i]] != 1)
str[tail++] = str[i];
i++;
}
str[tail]='\0';
printf("%s", str);
}
output : Bttl f th vwls: Hw vs. Grnzy
On Sun, Sep 11, 2011 at 1:27 PM, sukran dhawan <[email protected]>wrote:
> #include<bitset>
> #include<iostream>
> #include<queue>
> using namespace std;
> int main()
> {
> char answer;
> bitset<26> charset;
> bitset<26> repeat;
> char a[]={'s','a','s','a','b','v','s','a'};
> #ifdef TEST
> gets(a);
> #endif
> int i;
> for(i=0;a[i]!='\0';i++){
> if(charset.test(a[i]-'a')) {
> repeat.set(a[i]-'a');
> }
>
> charset.set(a[i]-'a');
> }
>
> for(int j=0;j<i;j++)
> {
> if(!repeat.test(a[j]-'a')){
> cout<<a[j]<<endl;
> return 0;
> }
> }
>
> cerr<<"No non repeating Character"<<endl;
> return 0;
>
>
> On Sun, Sep 11, 2011 at 9:16 PM, Kamakshii Aggarwal <[email protected]
> > wrote:
>
>> @neha:can u pls explain ur method?
>>
>>
>> On Sun, Sep 11, 2011 at 9:09 PM, sukran dhawan <[email protected]>wrote:
>>
>>> ya +1 to neha use bitset concept in c++
>>>
>>>
>>> On Sun, Sep 11, 2011 at 8:24 PM, Neha Singh
>>> <[email protected]>wrote:
>>>
>>>> for ques 1 use bit manipulation
>>>> its more efficient
>>>>
>>>> --
>>>> 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.
>>>>
>>>
>>> --
>>> 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.
>>>
>>
>>
>>
>> --
>> Regards,
>> Kamakshi
>> [email protected]
>>
>> --
>> 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.
>>
>
> --
> 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.
>
--
**Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers <=> Save Trees
*BharatKumar Bagana*
**http://www.google.com/profiles/bagana.bharatkumar<http://www.google.com/profiles/bagana.bharatkumar>
*
Mobile +91 8056127652*
<[email protected]>
--
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.