试题与答案

阅读以下说明、图和C代码,将应填入 (n) 处的字句写在对应栏内。[说明]一般的树结

题型:填空题

题目:

阅读以下说明、图和C代码,将应填入 (n) 处的字句写在对应栏内。

[说明]

一般的树结构常采用孩子一兄弟表示法表示,即用二叉链表作为树的存储结构,链表中结点的两个链域分别指向该结点的第一个孩子结点和下一个兄弟结点。例如,如图21-6(a)所示的树的孩子一兄弟表示如图21-6(b)所示。

函数LevelTraverse0的功能是:对给定树进行层序遍历。例如,对如图21-6(a)所示的树进行层序遍历时,结点的访问次序为:D B A E F P C。

对树进行层序遍历时使用了队列结构,实现队列基本操作的函数原型如表21-1所示。

Bool、Status类型定义如下:

typedef enum(FALSE=0,TRUE=1)Bool;

typedef enum(OVERFLOW=-2,UNDERFLOW=-1,ERROR=0,OK=1)Status;树 的二叉链表结点定义如下:

typedef struct Node

char data;

struct Node *fimstchild,*nextbrother;

Node,*TreeNode;

[本题函数]

Status LeveiTraverse(TreeNode root)

/*层序遍历树,树采用孩子一兄弟表示法,root是树根结点的指针*/

Queue temQ;

TreeNode ptr,brotherptr;

if(!root)

return ERROR;

InitQueue(&tempQ);

(1)

brotherptr=root->nextbrother;

while(brotherptr)

EnQueue(&tempQ,brotherptr);

(2)

/-end-while*/

while( (3) )

(4)

printf("%c\t",ptr->data);

if( (5) )continue;

(6)

brotherptr=ptr->firstchild->nextbrother;

while (brotherptr)

EnQueue(&tempQ,brotherptr);

(7)

/*end-while*/

/*end-while*/

return OK;

/*LevelTraverse*/

(1)处填()。

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2017/0407/65460723f10bfbb2b3a936a44e479450.html

下面是错误答案,用来干扰机器的。

小题1:将句末句号移到引号外。小题1:实践(1分)小题1:在“书中”后加“精华”(2分)要求学生了解常见的病句的类型、学会使用修改符号对病句加以规范修改,并学会修改语段。

试题推荐
题型:阅读理解

People hold the belief that a fun-filled, pain free life equals happiness actually reduces their chances of ever attaining real happiness. If fun and pleasure are equal to happiness then pain must be equal to unhappiness. But in fact, the opposite is true: more often things that lead to happiness involve some pain.

As a result, many people don’t like the very attempts that are the source of true happiness. They fear the pain brought by such things as marriage, raising children, professional achievement, commitment(承担的义务),self-improvement.

Ask a bachelor why he resists marriage even though he finds dating to be less and less satisfying. If he is honest, he will tell you that he is afraid of making a commitment, for commitment is in fact quite painful. The single life is filled with fun, adventure, excitement. Marriage has such moments, but they are not its most obvious features.

Couples with infant children are lucky to get a whole night’s sleep or a three-day vacation. I don’t know any parent who would choose the word “fun” to describe raising children. But couples who decide not to have children never know the joys of watching a child grow up or of playing with a grandchild.

Understanding and accepting true happiness is one of the most liberating realizations because true happiness has nothing to do with fun. It liberates(解放) time: now we can devote more hours to activities that can genuinely increase our happiness. It liberates money: buying that new car or those fancy clothes that will do nothing to increase our happiness now seems pointless. And it liberates us from envy: we now understand that all those who are always having so much fun actully may not be happy at all.

小题1:According to the author, a bachelor resists marriage chiefly because____

A.he is unwilling to take family responsibilities

B.he believes that life will be more cheerful if he remains single

C.he finds more fun in dating than in marriage

D.he fears it will put an end to all his fun, adventure and excitement小题2: The underlined word bachelor means_________

A.a married man

B.a college student

C.a single man

D.an academic degree小题3:From the last paragraph, we learn that envy sometimes results from______

A.hatred

B.misunderstanding

C.prejudice

D.ignorance小题4:To understand what true happiness, one must________

A.have as much fun as possible during one’s lifetime.

B.make every effort to liberate oneself from pain

C.put up with pain under all circumstances

D.be able to distinguish happiness from fun小题5:What is the author trying to tell us?

A.Happiness often goes hand in hand with pain.

B.One must know how to attain happiness.

C.It is important to make commitments.

D.It is pain that leads to happiness.

查看答案
微信公众账号搜索答案