首页 > 其他 > 详细

35.第一个只出现一次的字符

时间:2015-07-10 16:40:07      阅读:114      评论:0      收藏:0      [点我收藏+]

技术分享

技术分享技术分享

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‘;
}

技术分享

技术分享技术分享


版权声明:本文为博主原创文章,未经博主允许不得转载。

35.第一个只出现一次的字符

原文:http://blog.csdn.net/wangfengfan1/article/details/46831459

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!