求职
您所在位置:求职指南网 >> 求职就业求职笔试面试笔试题目中兴在我们学校的笔试

中兴在我们学校的笔试

07-19 17:16:57| http://www.caiwu51.com |笔试题目|人气:936我要推荐此文给好友

中兴在我们学校的笔试,本站还有更多笔试题目,银行笔试题目,企业笔试题目,求职笔试方面的资料。
正文:

  

20xx年12月中兴在我们学校的笔试,最后的大题/P

(其实这些大公司的笔试不难,也不就是如此,只要学一下数据结构就可以搞定!)

排序及查找方法

#include malloc.h
#includestdio.h
#define N 11
/*用监视哨查找*/
int search(int array[],int n,int k)
{int i;
i=n-1;
array[0]=k;
while(array[i]!=k) i--;
return(i);
}
/*折半查找法*/
int halfsearch(int array[],int n,int k)
{int i,j,mid;
i=1;j=n;
while(i=j)
{mid=(i j)/2;
if(k==array[mid]) return(mid);
else if(karray[mid]) j=mid-1;
else i=mid 1;
}
return(0);
}

/*冒泡排序法*/
void mpsort(int array[])
{int i,j,a;
a=0;
for(i=1;iN;i )
for(j=i 1;jN;j )
if(array[i]array[j])
{a=array[i];
array[i]=array[j];
array[j]=a;}
}
/*直接插入排序*/
void insertsort(int array[])
{int i,j;
for(i=2;iN;i )
{array[0]=array[i];
j=i-1;
while(array[0]array[j])
{array[j 1]=array[j--];
array[j 1]=array[0];
}
}
}
/*建立*/
void creat(int array[])
{int i;
printf(enter the array:);
for(i=1;iN;i )
scanf(%d,array[i]);
}

/*显示*/
void print(int array[])
{int i;
printf(The numbers after sort is:);
for(i=1;iN;i )
printf(%d ,array[i]);
printf();
}


main()
{int a[11],i,x,chang;
/*printf(enter the array);
for(i=1;i11;i )
scanf(%d,a[i]);*/

aga:
printf(chang:1: use watching method finding 2:use half method finding 3: use directness intsert method sort 4:use bubble up method sort 5:exit);
scanf(%d,chang);
switch (chang)
{case 1:
{creat(a);
printf(Please int the search number:);
scanf(%d,x);
printf(The number station is:%d,search(a,N,x));
goto aga;
}
case 2:
{ creat(a);
insertsort(a);
print(a);
printf(Please int the search number:);
scanf(%d,x);
printf(The number station is:%d,halfsearch(a,N,x));
goto aga;
}
case 3:
{creat(a);
insertsort(a);
print(a);
goto aga;
}

case 4:
{creat(a);
mpsort(a);
print(a);
goto aga;
}

case 5:{ printf(exit!);break;}
default:{printf(Error!); goto aga;}
}
}


二、线性链表的存储实现

struct LNODE{

ElemType data;

struct LNODE *next;

};

typedef struct LNODE LNode;

typedef struct LNODE * LinkList;

1初始化操作

Status Init_L(LinkList L){

if (L=(LinkList *)malloc(sizeof(LNode)))

{L-next=NULL;return 1;}

else return 0;

}

2插入操作

Status ListInsert_L(LinkList L,int i,ElemType e){

p=L,j=0;

while(pji-1){p=p-next; j;}

if(!p||ji-1) return ERROR;

如果觉得《中兴在我们学校的笔试》不错,可以推荐给好友哦。


文章关键字:求职笔试面试 - 笔试题目,银行笔试题目,企业笔试题目,求职笔试   

与中兴在我们学校的笔试 相关的文章