恒生电子

简介:

1.    Please specify what does “func()” do with the list "pParam", and what are the errors.

struct LIST 

    int nValue; 
    struct LIST * pPrev; 
    struct LIST * pNext; 
}; 
struct LIST * func(struct LIST * pParam) 

    struct LIST* pCur = pParam; 
    struct LIST* pNext; 
    struct LIST* pPrev = NULL; 
    struct LIST* pTail; 
    struct LIST* pReturn = NULL;

    if (pCur == NULL) 
    { 
        return pReturn; 
    } 
    else 
    { 
        pPrev = pCur->pPrev; 
        if (pCur->pNext == NULL) 
        { 
             pReturn = pCur; 
        } 
        else 
        { 
             pReturn = pCur->pNext; 
        } 
    }

    while (pCur != NULL) 
    { 
        pNext = pCur->pNext; 
        if (pNext == NULL) 
        { 
            return pReturn; 
        } 
        else 
        { 
            pTail = pNext->pNext;

            pNext->pPrev = pPrev; 
            pNext->pNext = pCur; 
            pCur->pPrev = pNext; 
            if (pTail == NULL) 
            { 
                pCur->pNext = pTail; 
            } 
            else 
            { 
                if (pTail->pNext == NULL) 
                { 
                    pCur->pNext = pTail; 
                } 
                else 
                { 
                    pCur->pNext = pTail->pNext; 
                } 
            } 
        }

        pPrev = pCur; 
        pCur = pTail; 
    }

    return pReturn; 

2.    Please complete the standard C function: memmove(), here is the description (don’t use any C standard function): 
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.    please complete this function, get binary tree’s depth. For example, the following binary tree’s depth is 4. The function returns depth. 
   1 
/     \ 
2    3 
     /       \ 
   4          5 
/     \ 
6        7

struct NODE 

    struct NODE* pLeft;        // pLeft is NULL if it has no left sub node 
    struct NODE* pRight;    // pRight is NULL if it has no right sub node 
}; 
int GetDepth(const struct NODE* pRoot) 

}

4.    A worker needs to do A work and B work. B’s priority is higher than A. For example, if he shall do A from 9:00 to 13:00, and shall doing B from 10:00 to 11:00, his choice shall be doing A from 9:00 to 10:00, doing B from 10:00 to 11:00, and doing A from 11:00 to 13:00.

Complete the following function (you can use pseudo-code or solution steps explanation instead of actual code), ”pSchedule“ is a worker’s work schedule (it’s an array), "nNum" is number of elements in array "pSchedule", "ppResult" is the result array which shall be returned and its buffer shall be allocated by yourself, "nRNum" is number of elements in “ppResult". The time phases in "pSchedule" cover each other, and not sorted, the output data in "ppResult" shall be a new schedule that are not covered of any phase, and sorted by start time. Return 0 if success.

enum WORK 

    A,        // A work 
    B        // B work 
}; 
struct SCHED 

    int nStartHour;        // at that hour work start 
    int nEndHour;            // at that hour work end 
    enum WORK work;        // work type 
}; 
int func(const struct SCHED* pSchedule, unsigned int nNum, struct SCHED** ppResult, unsigned int& nRNum) 

}

1.    请指出以下函数对参数"pParam"做了什么动作,并指出其中的错误

    将链表中的元素奇数位与偶数位互换。

int func(struct LIST * pParam) 

    // … … 
    while (pCur != NULL) 
    { 
        pNext = pCur->pNext; 
        if (pNext == NULL) 
        { 
            pCur->pPrev = pPrev; 
            return pReturn; 
        } 
        // … … 
    } 
    return pReturn; 
}

2.    请完成标准C函数:memmove()

void *memmove(void *dest, const void *src, size_t count) 

    char *tmp; 
    const char *s;

    if (dest == NULL || src == NULL) 
    { 
        return NULL; 
    }

    if (dest <= src) { 
        tmp = dest; 
        s = src; 
        while (count–) 
            *tmp++ = *s++; 
    } else { 
        tmp = dest; 
        tmp += count; 
        s = src; 
        s += count; 
        while (count–) 
            *–tmp = *–s; 
    } 
    return dest; 
}

3.    请完成以下函数,返回二叉树的深度。例如下面所示二叉树的深度为4。

#include <stdlib.h>

struct NODE 

    struct NODE* pLeft;    // pLeft is NULL if it has no left sub node 
    struct NODE* pRight;    // pRight is NULL if it has no right sub node 
};

int GetDepth(const struct NODE* pRoot) 

    if (pRoot == NULL) 
    { 
        return 0; 
    } 
    int nLeft = GetDepth(pRoot->pLeft); 
    int nRight = GetDepth(pRoot->pRight); 
    return nLeft > nRight ? nLeft + 1 : nRight + 1; 
}

4.    工人需要做A工作和B工作。B工作的优先级比A工作更高。例如,如果他要在9:00至13:00做A工作,而且在10:00至11:00做B工作,那么他 应该在9:00至10:00做A工作,在10:00至11:00做B工作,在11:00至13:00做A工作。 
完成下面函数,"pSchedule"是工人的工作计划(它是一个数组),"nNum"是数组"pSchedule"中的元素数量,"ppResult" 是需要返回的结果数组,"nRNum"是结果中的元素数量。"pSchedule"中的时间段互相覆盖,而且未排序,输出结果"ppResult"中的时 间段不允许有覆盖,并且按开始时间排序。函数执行成功返回0。


//以下是2011年的笔试题

5、已知2010年的1月1日是星期五,写一个函数,输入M年和N 月,计算出该月的第3个星期五是几号?


6、写SQL 语句的题,其中有一个是如何创建索引?

答案:(http://www.cnblogs.com/hanjin/archive/2008/09/09/1287505.html

 

转自:http://www.cnblogs.com/cswolf/archive/2011/10/13/2267124.html  





本文转自夏雪冬日博客园博客,原文链接:http://www.cnblogs.com/heyonggang/archive/2012/12/13/2817113.html,如需转载请自行联系原作者

目录
相关文章
|
6月前
|
机器学习/深度学习 人工智能 自然语言处理
视觉感知RAG×多模态推理×强化学习=VRAG-RL
通义实验室自然语言智能团队发布并开源了VRAG-RL,一种视觉感知驱动的多模态RAG推理框架。它能像人一样“边看边想”,通过粗到细的视觉仿生感知机制,逐步聚焦关键区域,精准提取信息。VRAG-RL结合强化学习与多专家采样策略,优化检索与推理路径,在多个视觉语言基准数据集上表现出色,显著提升准确性和效率。项目已发布技术方案并开源代码,支持快速部署和二次开发。
429 11
|
5月前
|
敏捷开发 人工智能 监控
任务反馈闭环管理:打造高效执行力的17个关键环节全解析
任务反馈闭环管理是一种确保任务从布置到完成全过程信息透明的管理方法,其核心是通过"计划-执行-反馈-改进"的完整循环,解决传统管理中常见的"任务黑洞"问题。这种机制强调责任明确、流程标准化、反馈及时和持续优化,能够显著提升执行力、团队协同效率和组织的敏捷性。关键环节包括SMART目标设定、标准化执行流程、量化反馈机制和PDCA持续改进。有效的闭环管理需要制度设计、工具支持和流程优化的协同配合,并通过五大KPI(任务完成率、反馈及时率等)进行量化评估。实施闭环管理虽面临员工适应、流程复杂等挑战,但数字化转型和智能化工具的应用正推动其向更高效的方向发展。闭环管理不仅是提升效率的工具,更是促进组织持
545 0
|
缓存 负载均衡 网络协议
|
人工智能 自然语言处理
通义灵码在Visual Studio2022中的实践
本文介绍了如何在Visual Studio 2022中安装和使用通义灵码。首先,在Visual Studio 2022中安装通义灵码插件,然后按照步骤完成安装和登录。最后,通过实操演示了通义灵码的三大功能:行级/函数级实时续写、自然语言生成代码和研发领域自由问答。希望读者能从中受益。
5624 4
|
域名解析 运维 网络协议
网络诊断指南:网络故障排查步骤与技巧
网络诊断指南:网络故障排查步骤与技巧
4391 7
|
存储 JSON Java
elasticsearch学习一:了解 ES,版本之间的对应。安装elasticsearch,kibana,head插件、elasticsearch-ik分词器。
这篇文章是关于Elasticsearch的学习指南,包括了解Elasticsearch、版本对应、安装运行Elasticsearch和Kibana、安装head插件和elasticsearch-ik分词器的步骤。
1213 0
elasticsearch学习一:了解 ES,版本之间的对应。安装elasticsearch,kibana,head插件、elasticsearch-ik分词器。
|
分布式计算 MaxCompute 计算机视觉
ODPS问题之odps.sql.mapper.split.size属性有什么作用,以及如何根据场景调整它
ODPS问题之odps.sql.mapper.split.size属性有什么作用,以及如何根据场景调整它
1076 1
|
人工智能 JavaScript Python
微软会用Python替代VBA吗?
微软会用Python替代VBA吗?
242 3
|
安全 虚拟化 C++
vmware虚拟机网络连接选nat后不能上网的解决办法
自己在vmware虚拟机中安装好系统并选择nat上网方式后发现无论怎么都不能联网。   后来仔细查找原因,发现Microsoft    visual   c++好像被我删掉了,是不是这个软件呢?我原先想打开这个软件,但是它显示没有目录,我就删掉了,没想到   vmware是要在里面调动数据的,而vpc   vbox   是不用的,所以缺了它 vpc  vbox   可以上网,而vmware就不能上网,我赶紧下载了一个,这回打开虚拟机,再把网络连接选nat ,再把虚拟机里的本地连接连上,就可以上网了。
1077 0