恒生电子笔试题3(2)
时间:2025-03-11
时间:2025-03-11
恒生电子笔试题
return nNum; } else { struct NODE_LIST* pNew = sub_func(pTree, *ppList); int nTemp = 0; if (pTree->pLeft != NULL) { nTemp += func(pTree->pLeft, &pNew); if (pNew == NULL) { return -1; } } if (pTree->pRight != NULL) { nTemp += func(pTree->pRight, &pNew); if (pNew == NULL) { return -1; } } return nTemp + 1; } }
2. please complete the standard C function: memmove(), here is the description ():
void * memmove (void *to, const void *from, unsigned int size)
memmove copies the size bytes at from into the size bytes at to. The value returned by memmove is the value of to.
3. Given a decimal number, return the number in string of specified base (The base of a system of numbers, such as 2 in the binary system and 10 in the decimal system). The base is bigger than 1 and less than 10. For example, the given number is 99 in decimal, and return string “143” of base 8 (char* GetNumber(unsigned int nNum, unsigned int nBase) { }
4. Find a path from start position to end position in maze. The maze's width is 8, and height is 8 too, it is expressed by an two-dimensional array, the start position of it is left-up corner and its coordinate is (0, 0), and the end position is right-down corner and coordinate (7, 7). Each integer element in array defines connectivity of a block, 0 if disconnected, others
connected. For example, a path is painted in different color in the following maze expressed
恒生电子笔试题
of actual code), the array "maze" is the map of a maze, the size is 8*8. Save found path in "maze" before function return non-zero, if you find. And return 0 if there is no path which can reach end point. The returned "maze" shall be cleared with "0" except the path, as
int path(int maze[8][8]);
上一篇:09级电信二班赵晓飞毕业论文