This code works perfectly. Try out with different test data.
int main()
{
//char str[]="qwertyuioplkjhgfdsazxcvbnm";
char str2[] = "qwertyquejolpd";
int val, i;
int len = strlen(str);
int unique=1;
int checker=0;
for(=0;i<len;i++)
{
val = str[i]-'a';
if( (checker & (1<<val)) > 0 )
{
printf("\nNo, there aren't unique.");
unique=0;
break;
}
checker |= (1<<val);
}
if(unique==1)
printf("\nUnique charaters.");
return 1;
}
On Sat, Jul 23, 2011 at 12:18 PM, rajeev bharshetty <[email protected]>wrote:
> @Victor : Counting sort uses extra data structures to maintain the count
> and the output array , so it is not viable I think ?? what say ??
>
>
> On Sat, Jul 23, 2011 at 11:04 AM, Victor Manuel Grijalva Altamirano <
> [email protected]> wrote:
>
>> Use a type of counting sort with ascii
>>
>>
>> 2011/7/22 SkRiPt KiDdIe <[email protected]>
>>
>>> Use 8 mask integers or 4 LL to cover the complete ascii range.
>>>
>>> --
>>> 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.
>>>
>>
>>
>>
>> --
>> Victor Manuel Grijalva Altamirano
>> Universidad Tecnologica de La Mixteca
>>
>> --
>> 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
> Rajeev N B <http://www.opensourcemania.co.cc>
>
>
> --
> 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
Reynald Reni
Masters in Software Engineering
CIT - India
--
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.