问题 填空题

阅读以下说明和算法,完善算法并回答问题,将解答写在对应栏内。
[说明]
假设以二维数组G[1..m,1..n]表示一幅图像各像素的颜色,则G[i,j]表示区域中点(i,j]处的颜色,颜色值为0到k的整数。
下面的算法将指定点(i0,j0)所在的同色邻接区域的颜色置换为给定的颜色值。约定所有与点(i0,j0)同色的上、下、左、右可连通的点组成同色邻接区域。
例如,一幅8×9像素的图像如图1-1所示。设用户指定点(3,5),其颜色值为0,此时其上方(2,5)、下方(4,5)、右方(3,6)邻接点的颜色值都为0,因此这些点属于点(3,5)所在的同色邻接区域,再从上、下、左、右四个方向进行扩展,可得出该同色邻接区域的其他点(见图1-1中的阴影部分)。将上述同色区域的颜色替换为颜色值7所得的新图像如图1-2所示。


[算法]
输入:矩阵G,点的坐标(i0,j0),新颜色值newcolor。
输出:点(i0,j0)所在同色邻接区域的颜色置换为newcolor之后的矩阵G。
算法步骤(为规范算法,规定该算法只在第七步后结束):
第一步:若点(i0,j0)的颜色值与新颜色值newcolor相同,则 (1)
第二步:点(i0,j0)的颜色值→oldcolor;创建栈S,并将点坐标(i0,j0)入栈;
第三步:若 (2) ,则转第七步;
第四步:栈顶元素出栈→(x,y),并 (3)
第五步:
1) 若点(x,y-1)在图像中且G[x,y-1]等于oldcolor,则(x,y-1)入栈S;
2) 若点(x,y+1)在图像中且G[x,y+1]等于oldcolor,则(x,y+1)入栈S;
3) 若点(x-1,y)在图像中且G[x-1,y]等于oldcolor,则(x-1,y)入栈S;
4) 若点(x+1,y)在图像中且G[x+1,y)等于oldcolor,则(x+1,y)入栈S:
第六步:转 (4)
第七步:算法结束。
[问题]
是否可以将算法中的栈换成队列回答: (5)

答案

参考答案:转第七步

问答题 简答题
单项选择题

Teachers need to be aware of the emotional, intellectual, and physical changes that younga-duhs experience. And they also need to give serious (91) to how they can best (92) such changes. Growing bodies need movement and (93) , but not just in ways that emphasize competition. (94) they are adjusting to their new bodies and a whole host of new intellectual and emotional challenges, teenagers are especially self-conscious and need the (95) that comes from achieving success and knowing that their accomplishments are (96) by others. However, the typical teenage lifestyle is already filled with so much competition that it would be (97) to plan activities in which there are more winners than losers, (98) , publishing newsletters with many student-written book reviews, (99) student artwork, and sponsoring book discussion clubs. A variety of small clubs can provide (100) opportunities for leadership, as well as for practice in successful (101) dynamics. Making friends is extremely important to teenagers, and many shy students need the (102) of some kind of organization with a supportive adult (103) visible in the background.
In these activities, it is important to remember that young teens have (104) attention spans. A variety of activities should be organized (105) participants can remain active as long as they want and then go on to (106) else without feeling guilty and without letting the other participants (107) This does not mean that adults must accept irresponsibility. (108) , they can help students acquire a sense of commitment by (109) for roles that are within their (110) and their attention spans and by having clearly stated rules.

A.care

B.nutrition

C.exercise

D.leisure