//在字符串中找出第一个只出现一次的字符
char FirstNotRepeatingChar(char* pSring)
{
if(pSring==NULL)
return '\0';
const int tableSize=256;
unsigned int hashTable[tableSize];
for(unsigned int i=0;i<tableSize;++i)
{
hashTable[i]=0;
}
char* pHashKey=pSring;
while(*(pHashKey)!='\0')
hashTable[*(pHashKey++)]++;
pHashKey=pSring;
while(*pHashKey!='\0')
{
if(hashTable[*pHashKey]==1)
return *pHashKey;
pHashKey++;
}
}
在字符串中找出第一个只出现一次的字符
最新推荐文章于 2021-02-10 13:26:49 发布