1 / 8
文档名称:

阿里巴巴笔试题.docx

格式:docx   大小:16KB   页数:8页
下载后只包含 1 个 DOCX 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

阿里巴巴笔试题.docx

上传人:guoxiachuanyue001 2022/5/10 文件大小:16 KB

下载得到文件列表

阿里巴巴笔试题.docx

文档介绍

文档介绍:下列不属于hash碰撞解决方法是。
线性探测
单旋转法@
二次探测
拉链法
双重散列
多重散列
在32位操作系统中,下列类型占用8个字符的为。
shortintintClongunsignedintlonglong@
ch时候小孩左右只能是其他小孩或者自己的父母。那么5对父子在圆桌上共有种坐法。(旋转一下,每个
人面对的方向变更后算是一种新的坐法)
960
3120
2400
7200
7440
9600
下列描述中,唯一错误的是
本题有五个选项是正确的
B正确
D正确
DEF都正确
ABC中有一个错误
如果ABCDE都正确,那么F也正附加题
1、
写一个函数,输入一个二叉树,树中每个节点存放了一个整数值,函数返回这棵二叉树中相差最大的两个节点间的差值绝对值。请注意程序效率。
答案1、ntmin,max=0;
//初始化min,max
voidinit(BT*bt){
//初始化min,max
if(head!二NULL){
min=
max
head—>data;min;
}
//用于计算最大最小值差的函数
//函数返回最大最小值差的绝对值
intfind(BT*bt){
BT*head=bt;
//中序遍历,并求得最大、最小值
while(head!=NULL){
find(head-lchild);
if(min>head->data){
min=head->data;
}
if(max<head->data){
max=head->data;
}
find(head->rchild);
}
return(max-min);
}
答案2#include<>
#include<>
#include<>
#include<>
typedefstructTREE_NODE
{—
intvalue;
structTREE_NODE*left;
structTREE_NODE*right;
}TreeNode;
staticTreeNode*tree;
void
insert(intvalue)
{
TreeNode*current;
TreeNode**link;
link=&tree;
while((current二*link)!=NULL){if(value<current->value)link=&current->left;
else{
assert(value!=current->value);
link
&current->right;
}
current二(TreeNode*)malloc(sizeof(TreeNode));assert(current!=NULL);
current->value=value;
current->left二NULL;
current->right二NULL;
*link=current;
}intmain(void)
{
inti;
intvalue;
for(i=0;i<5;i++)
{
printf("inputthe%dvalue:",i+l);sca