阅读背景:

两个字符串A,B,在A中删除B的元素

来源:互联网 
//we are students --- aeiou ===  w r stdnts
char* DeleteTwoInOne(char first[],char second[])
{
	if (first == NULL || second == NULL)
		return NULL;
	int i;
	const int TableSize = 256;
	unsigned int hashTable[TableSize];
	for (i = 0; i < TableSize; i++)
	{
		hashTable[i] = 0;
	}
	char *secondkey = second;
	while (*(secondkey) != '
//we are students --- aeiou ===  w r stdnts
char* DeleteTwoInOne(char first[],char second[])
{
	if (first == NULL || second == NULL)
		return NULL;
	int i;
	const int TableSize = 256;
	unsigned int hashTable[TableSize];
	for (i = 0; i < TableSize; i++)
	{
		hashTable[i] = 0;
	}
	char *secondkey = second;
	while (*(secondkey) != '\0')
	{
		hashTable[*(secondkey++)]++;
	}
	char *firstkey = first;
	char *result,*temp;
	result = firstkey;
	while (*firstkey)
	{
		if (hashTable[*firstkey] == 1)
		{
			temp = firstkey;
			while (*temp)
			{
				*(temp) = *(temp + 1);
				temp++;
			}
		}
		firstkey++;
	}
	return result;
}


') { hashTable[*(secondkey++)]++; } char *firstkey = first; char *result,*temp; result = firstkey; while (*firstkey) { if (hashTable[*firstkey] == 1) { temp = firstkey; while (*temp) { *(temp) = *(temp + 1); temp++; } } firstkey++; } return result; }//we are students --- aeiou === w r stdnts cha



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: