aftyingjiesheng 发表于 2011-5-19 10:33

Microsoft实习生面试时的笔试

Microsoft实习生面试时的笔试

zz

                  (08年微软实习生)            
总共2大题
第一题 (数据结构题)
读程序 补充程序中缺少的部分 难度不大

本次笔试程序的内容是数据结构中的线性表的链式存储
程序中出现需要补充的几个主要的函数:线性链表的创建,插入,删除,判断链表是否为循环链表。
程序用c语言描述 ,指针一定要掌握好。

以下程序自己所写
仅供参考:
(以下程序在vc6.0中编译通过)


//Copyrightshuchen
//
//描述:程序描述了单链表的创建,插入,删除
//注意:判断是否循环链表由读者自己实现
//
//作者:胡琛 <huc87@126.com>
//日期:2007-7-22, 16:38:25
#include <stdio.h>

#define ERROR_OK 0
#define ERROR_OUT_OF_MEMORY 1
#define ERROR_OVERFLOW 2

struct LNode
{
    int data;
    LNode *next;
};
//创建一个链表 length为要创建链表的大小, head为头指针
int CreateList(LNode *&head, int length)
{
    head = new LNode();
    if(!head)
    {
      return ERROR_OUT_OF_MEMORY;
    }
    head->next = NULL;
    LNode *p;
    printf("please enter the element:\n");
    for(int i = 0; i < length; ++i)
    {
      p = new LNode();
      if(!p)
      {
            return ERROR_OUT_OF_MEMORY;
      }
      scanf("%d", &(p->data));
      p->next = head->next;
      head->next = p;
    }
    return ERROR_OK;
}
//插入一个节点
int Insert(LNode *head, int location)
{
    int index = 1;
    while(index < location && head->next)
    {
      head = head->next;
      ++index;
    }
    if(!(head->next))
    {
      printf("overflow!\n");
      return ERROR_OVERFLOW;
    }
    LNode *p = new LNode();
    if(!p)
    {
      return ERROR_OUT_OF_MEMORY;
    }
    printf("input an number you want insert:\n");
    scanf("%d", &(p->data));
    p->next = head->next;
    head->next = p;

    return ERROR_OK;
}
//删除一个节点
int Delete(LNode *head, int location)
{
    int index = 1;
    while(index < location && head->next) //index 保证指针指向要插入位置的前一个节点,
    {                                    // 第2个条件保证指针越界后指向最后一个节点
      head = head->next;
      ++index;
    }
    if(!(head->next))
    {
      printf("overflow!\n");
      return ERROR_OVERFLOW;
    }
    LNode *p = head->next;
    head->next = p->next;
    delete p;
    return ERROR_OK;
}
void ShowLinkList(LNode *head)
{
    printf("LinkList:");
    LNode *p = head->next;
    while(p)
    {
      printf("%d ", p->data);
      p = p->next;
    }
    printf("\n");
}

void main()
{
   
    LNode *head = NULL;
    int initialLength,location;
   
    printf("please input an number to initilize the LinkList:\n"); //初始化链表的元素个数
    scanf("%d", &initialLength);

    if(!CreateList(head, initialLength))
    {
      printf("Create LinkList Success! \n");
    }
    ShowLinkList(head);

    printf("please input an location you want to insert to:\n");
    scanf("%d", &location);

    if(!Insert(head, location))
    {
      printf("Insert success!\n");
    }
    ShowLinkList(head);

    printf("please input an location you want to delete:\n");
    scanf("%d", &location);

    if(!Delete(head, location))
    {
      printf("Delete success!\n");
    }
    ShowLinkList(head);
}

第一题总结:把数据结构中的基础打牢(不可能一直考链表)

第二题
英译中
英语文章:长度 和难度都跟四级中阅读理解的文章差不多


……

http://bbs.aftjob.com/thread-607297-1-1.html

——
微软(Microsoft)求职俱乐部
http://bbs.aftjob.com/group-100-1.html
2012阿凡提求职手册——IT行业篇
http://bbs.aftjob.com/thread-607158-1-1.html
——
微软笔经篇
http://bbs.aftjob.com/thread-469556-1-1.html
微软2007年笔试题
http://bbs.aftjob.com/thread-607298-1-1.html
微软今天的笔试题目(12月28日)
http://bbs.aftjob.com/thread-29793-1-1.html
微软笔试题整理
http://bbs.aftjob.com/thread-607299-1-1.html
——
阿凡提(aftjob.com)求职社区
阿凡提求职俱乐部-国内第一家网络求职俱乐部,提供企业求职俱乐部和高校求职俱乐部交流平台。
——


页: [1]
查看完整版本: Microsoft实习生面试时的笔试