华为笔试题.doc
单选20,多选10,改错3,编程2有数据结构、网络、操作系统、数据库
1、单项选择题(4选1)
<:
1.如果有N个节点用二叉树结构来存储,那么二叉树的最小深度是:
解析:深度为k的二叉树,最多有2~k-1个节点,这时的二叉树成为满二叉树。Log:(N+1)
2.形结构的一种重要运算。若已知一棵二叉树的前序序列是BEFCGDH,中序序列是FEBCCHD,则后序序列是:FEGHDCB
3.下列算法的功能是:
1杠是无头节点单链表*/
LinkList Demo(LinkList L){
ListNode *Q,*P:
If(L&&L一>next){
Q=L;
L=L->next;P=L;
While(p->next)P=p->next;p->next=Q;Q->next=NULL;
}
return L;
解析:将单链表转变为循环链表头结点转变为尾节点
(Single choice 20, multiple choice 10, error correction 3, programming 2
Data structure, network, operating system and database
1. Single choice questions (1 out of 4)
<:
1. if n nodes are stored in a binary tree structure, the minimum depth of the binary tree is:
Analysis: a binary tree with a depth of K has at most 2~k-1 nodes. At this time, the binary tree becomes a full binary tree. Log:(N+1)
2. an important operation of shape structure. If the pre sequence of a binary tree is known to be befcgdh and the mid sequence is febcchd, then the post sequence is feghdcb
3. the functions of the following algorithms are:
1 bar is a headless node single chain table*/
LinkList Demo(LinkList L){
ListNode *Q,*P:
If (l&&l I >next){
Q=L;
L=L->next; P=L;
While(p->next)P=p->next; p->next=Q; Q->next=NULL;
}
return L;
Analysis: transform a single linked list into a circular chain header node into a tail node)
页:
[1]