char FirstNotRepeatingChar(char* pString)
{
if (pString == NULL)
return ‘\0‘;
const int tableSize = 256;
unsigned int hashTable[tableSize];
for (unsigned int i = 0; i < tableSize; ++i)
hashTable[i] = 0;
char* pHashKey = pString;
while (*(pHashKey) != ‘\0‘)
hashTable[*(pHashKey++)]++;
pHashKey = pString;
while (*pHashKey != ‘\0‘)
{
if (hashtTable[*pHashKey] == 1)
return *pHashKey;
pHashKey++;
}
return ‘\0‘;
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/wangfengfan1/article/details/46831459