恒生电子

简介: 1.    Please specify what does “func()” do with the list "pParam", and what are the errors. struct LIST  {      int nValue;      struct LIST * pPr...

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  

img_e00999465d1c2c1b02df587a3ec9c13d.jpg
微信公众号: 猿人谷
如果您认为阅读这篇博客让您有些收获,不妨点击一下右下角的【推荐】
如果您希望与我交流互动,欢迎关注微信公众号
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。

目录
相关文章
|
7月前
|
传感器 存储 监控
常用电子元器件
常用电子元器件的介绍 一、电阻器(Resistor) 电阻器是一种用来限制电流流动的元件,它的主要作用是通过消耗电能将电流限制在一个特定的范围内。电阻器的阻值单位是欧姆(Ω),常用的电阻器有固定电阻器和可变电阻器两种。固定电阻器的阻值是固定不变的,而可变电阻器可以通过调节旋钮或滑动杆来改变其阻值。 二、电容器(Capacitor) 电容器是一种用来存储电荷的元件,它的主要作用是在电路中提供临时的电荷储存和释放功能。电容器的容值单位是法拉(F),常用的电容器有固定电容器和可变电容器两种。固定电容器的容值是固定不变的,而可变电容器可以通过调节旋钮或滑动杆来改变其容值。 三、电感器(Induc
111 0
|
11月前
|
开发框架 Rust 前端开发
金牛座与电子#137
金牛座与电子#137
71 0
|
存储 前端开发 JavaScript
完整电子病历源码
这是一套SaaS模式Java语言开发的云HIS系统的子系统云电子病历,本系统采用前后端分离模式开发和部署,支持电子病历四级,纯源码,支持二次开发。
564 1
完整电子病历源码
|
存储 数据管理
电子病历源码 MER医院电子病历系统源码
电子病历系统功能总览 模板制作、样式控制、数据存储、控件管理、表格管理、图片管理、页面布局、打印设置、 病历书写、样式控制、控件输入、病历质控、数据同步、个人模板、病历打印、辅助输入 视图层:数据存储、图片管理、页面布局 字体设置:控件管理、预定义控件、自定义控件、打印模块、常规打印、PDF打印、段落设置 表格管理 病历:辅助输入:当前日期、当前时间、医师签名、单位符号、检验报告、整体复制 逻辑控制层:模板数据上传和下载、控件数据管理服务、配置文件载入、PDF打印、 个人病历模板上传和下载、病历数据上传和下载、数据同步服务、病历质控服务、 人员相关信息管理服务、历史病历数解析
252 0
电子病历源码 MER医院电子病历系统源码
|
BI 流计算
“电子“ ”“”哪里有
“电子“ ”“”哪里有此外,为了帮助大家更加深入了解EMR StarRocks,我们推出了EMR StarRocks 白皮书,供各位小伙伴学习参考,免费下载! 白皮书下载:https://developer.aliyun.com/ebook/7585 内容一览表: ? StarRocks 新?代极速全场景 MPP 数据仓库 ? StarRocks 简介 ? StarRocks 架构 ? StarRocks 特性 ? StarRocks ?态与?具 ? 数据迁移 ? 数据摄? ? 湖仓?体 ? StarRocks X Flink ?态 ? StarRocks 场景解决?案 ? 固定报表业务 ?
|
传感器
可随身携带的电子乐队
可随身携带的电子乐队
可随身携带的电子乐队
|
运维 物联网 芯片
应用速递 | 电子价签方案
应用速递栏目:应用速递是面向IoT厂商推荐芯片开放社区(OCC)上的典型应用案例,便于IoT厂商精准获取方案,快速实现产品落地。
176 0
应用速递 | 电子价签方案
|
存储 监控 安全
财税行业 | 电子发票
本文介绍了财税行业 | 电子发票的方案概述,方案价值及优势以及最佳实践。
财税行业 | 电子发票
|
文字识别 供应链 安全
冷链食品的 “电子身份证”
近期,进口冷链食品外包装核酸阳性检出率明显增高。“涉及产品范围从海产品到畜禽肉类产品,进口物资被病毒污染范围从冷链食品扩展到集装箱。我们要继续坚持‘人’‘物’同防,强化疫情监测、信息报告和应急处置。”在国务院联防联控机制新闻发布会上,国家卫健委新闻发言人米锋表示。