阿尔卡特笔试题目之三

  1.自己定义数据结构,写出程序:在一个单向链表中,往I位置插入一个节点。

Typedef  struct  node{
        datatype  data;
        
struct   node  *next;
}
listnode;
typedef 
struct slist {
        
int count;
        listnode
* m_pNodeHead;
}
slist;

void  insertnode(linklist  head,datetype  x,int  i)
{
       listnode  
* p,*q;
      p
=getnode(head,i-1);
      
if(p==NULL)
           error(〝position  error〞);
      q
=(listnode *)malloc(sizeof(listnode));
      q–
>data=x;
      q–
>next=p–next;
      p–
>next=q;
}

 

  2.自己定义数据结构,写出程序:二叉树的前序遍历。

typedef BiTNode* SElemType;
typedef 
struct{
    SElemType 
*base;
    SElemType 
*top;
    
int stacksize;
}
SqStack;
void preorder(BiTree T)
{    
    SqStack S;      BiTree P
=T;
    InitStack(S);    Push(S,NULL);
    
while (P)
    
{     printf("%c",P->data);
           
if (P->rchild)
                 Push(S,P
->rchild);
           
if (P->lchild)
                P
=P->lchild;
           
else Pop(S,P);
    }

}

 

  3.不允许使用系统时间,写出一个随机数生成函数。

static   unsigned   long   seed   =   1;  
   
  #define   A   48271L  
  #define   M   2147483647L  
  #define   Q   (M   /   A)  
  #define   R   (M   %   A)  
   
  double  
  Random(void)  
  {  
          long   TmpSeed;  
          TmpSeed   =   A   *   (   Seed   %   Q)   -   R   *   (Seed   /   Q);  
          if(TmpSeed>=0)  
                  Seed   =   TmpSeed;  
            else  
                  Seed   =   TmpSeed   +   M;  
            return   (double)   Seed   /   M;  
  }  
  void   Initialize(unsigned   long   InitVal)  
  {  
                    Seed   =   InitVal;  
  }  

  这次是连环游戏,每一题的答案将在下一题中用到。

  1、{first 10-digit prime found in consecutive digits e}.com.

  e中出现的连续的第一个10个数字组成的质数。

  2、7427466391.com

  Congratulations,Youve made it to level 2. Go to www.Linux.org and enter

Bobsyouruncle as the login and the answer to this equation as the password.

  f(1)=7182818284

  f(2)=8182845904

  f(3)=8747135266

  f(4)=7427466391

  f(5)=__________

  update:提示:f(1)到f(4)是e中连续的10个数字满足总和等于49的前4个,f(5)当然

是让你搜索第5个咯,编个小程序吧。

  答案:5966290435

  3、www.Linux.org

  4、www.google.com/labjobs/

  via:

  Google recruits eggheads with mystery billboard

  Mysterious Billboard May Be Google Recruitment Ad

  Myserious billboard

  Google is behind mystery geek trap

  写一句俳句来描述搜索流量季节性预测的可能方法。

  用三种颜色为一个二十面体涂颜色,每面都要覆盖,你能够用多少种不同的涂法?你

将选择哪三种颜色?

  这是一个我们故意留给你你空白,请填充一些你喜欢的东西。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值